6396dfb97f13f5fbb0ef98cd5221600b89ff889a

Author
Sam Cook <sam.lindenrathen@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(kubectx): don't error on missing k8s context (#10675)

Diff

 1diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
 2index 1419f102f733cd5d96de797137cbda57a2d153ba..6096feeae43d36b01df762b01f4327bd315f6cda 100644
 3--- a/plugins/kubectx/kubectx.plugin.zsh
 4+++ b/plugins/kubectx/kubectx.plugin.zsh
 5@@ -3,7 +3,9 @@ typeset -g -A kubectx_mapping
 6 function kubectx_prompt_info() {
 7   (( $+commands[kubectl] )) || return
 8 
 9-  local current_ctx=$(kubectl config current-context)
10+  local current_ctx=$(kubectl config current-context 2> /dev/null)
11+
12+  [[ -n "$current_ctx" ]] || return
13 
14   # use value in associative array if it exists
15   # otherwise fall back to the context name