1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-28 14:40:06 +00:00

add POWERLEVEL9K_KUBECONTEXT_SHOW_DEFAULT_NAMESPACE option

This commit is contained in:
romkatv 2019-06-01 07:37:11 +02:00
parent 68e79d3cb5
commit b8b197ec17

View file

@ -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