aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-06-01 08:37:11 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-06-01 08:37:11 +0300
commitb8b197ec171574af75ada7d78aa344347b8ce464 (patch)
tree67a75ea10534c0bbfb645a69b819bfa5900ba418 /powerlevel9k.zsh-theme
parent68e79d3cb5602f02f2d6a28afe6f14761395cead (diff)
add POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE option
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme5
1 files changed, 4 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 50a8b943..c4b8133e 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -2057,6 +2057,7 @@ prompt_dir_writable() {
################################################################
# Kubernetes Current Context/Namespace
+set_default POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE true
prompt_kubecontext() {
(( $+commands[kubectl] )) || return
local cfg
@@ -2071,7 +2072,9 @@ prompt_kubecontext() {
if [[ -n $ctx ]]; then
local p="{.contexts[?(@.name==\"$ctx\")].context.namespace}"
local ns="${$(command kubectl config view -o=jsonpath=$p):-default}"
- [[ $ctx == $ns ]] || ctx+="/$ns"
+ if [[ $ctx != $ns && ($ns != default || $POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE == true) ]]; then
+ ctx+="/$ns"
+ fi
fi
_p9k_cache_set "$ctx"
fi