Closed fauzan-n closed 5 years ago
What are you trying to achieve? If you want to display your current kubernetes context, you can use kubecontext
prompt segment. Try this:
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(kubecontext)
# Don't show trailing "/default" in kubernetes context.
POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE=false
# Kubernetes context classes for the purpose of using different colors with different contexts.
#
# POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element in
# each pair defines a pattern against which the current kubernetes context (in the format it is
# displayed in the prompt) gets matched. The second element defines the context class. Patterns
# are tried in order. The first match wins.
#
# For example, if your current kubernetes context is "deathray-testing", its class is TEST because
# "deathray-testing" doesn't match the pattern '*prod*' but does match '*test*'. Hence it'll be
# shown with the background color of $POWERLEVEL9K_KUBECONTEXT_TEST_BACKGROUND.
POWERLEVEL9K_KUBECONTEXT_CLASSES=(
'*prod*' PROD
'*test*' TEST
'*' DEFAULT)
POWERLEVEL9K_KUBECONTEXT_PROD_BACKGROUND=1
POWERLEVEL9K_KUBECONTEXT_TEST_BACKGROUND=2
POWERLEVEL9K_KUBECONTEXT_DEFAULT_BACKGROUND=3
Does it do what you want?
P.S.
You have vcsi
in POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
but there is no such segment. Did you mean vcs
?
Sorry, I thought this issue was open against another github project. Powerlevel9k doesn't have the POWERLEVEL9K_KUBECONTEXT_*
options I mentioned. It does have POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(kubecontext)
though.
@romkatv Thanks That is what i'm lookin for
and yes i'm typo about vcsi , it should be vcs
How to reproduce : Add this configuration to .zshrc
Result expectation : Showing kubernetes cluster name
Result reality :
.zshrc:15: parse error near
|'`