mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
add POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE option
This commit is contained in:
parent
68e79d3cb5
commit
b8b197ec17
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue