mirror of
https://github.com/Powerlevel9k/powerlevel9k.git
synced 2024-09-21 10:27:12 +00:00
Hide kubecontext if there is no current context
This prevents a namespace from being shown on its own, when there's no context set to use it with anyway.
This commit is contained in:
parent
c4a8118b45
commit
4c081eba21
@ -1696,6 +1696,10 @@ prompt_kubecontext() {
|
||||
if [[ -n "$kubectl_version" ]]; then
|
||||
# Get the current Kuberenetes context
|
||||
local cur_ctx=$(kubectl config view -o=jsonpath='{.current-context}')
|
||||
if [[ -z "${cur_ctx}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cur_namespace="$(kubectl config view -o=jsonpath="{.contexts[?(@.name==\"${cur_ctx}\")].context.namespace}")"
|
||||
# If the namespace comes back empty set it default.
|
||||
if [[ -z "${cur_namespace}" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user