Last active
August 16, 2018 14:23
-
-
Save chazmaniandinkle/4299fc6d4fa44d8ee1614d21e5582239 to your computer and use it in GitHub Desktop.
Small script to allow for toggling the kubecontext element in the POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Version: 1.0 | |
# Date: 8/16/2018 | |
# Author: Chaz Dinkle | |
# Powerlevel9k kubectl toggle | |
kon () { | |
RPROMPT=($POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS) | |
if [[ ${RPROMPT[(ie)kubecontext]} -gt ${#RPROMPT} ]] | |
then | |
RPROMPT[1]=(kubecontext $RPROMPT) | |
else | |
echo "kubecontext already enabled." | |
fi | |
} | |
koff () { | |
RPROMPT=($POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS) | |
if [[ ${RPROMPT[(ie)kubecontext]} -lt ${#RPROMPT} ]] | |
then | |
RPROMPT[${RPROMPT[(ie)kubecontext]}]=() | |
else | |
echo "kubecontext already disabled." | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment