summaryrefslogtreecommitdiff
path: root/plugins/kubectx
diff options
context:
space:
mode:
authorSam Cook <sam.lindenrathen@gmail.com>2022-02-10 16:00:45 +0000
committerGitHub <noreply@github.com>2022-02-10 17:00:45 +0100
commit6396dfb97f13f5fbb0ef98cd5221600b89ff889a (patch)
tree2537334f2f51a6ec64331a262489e1119b2764cd /plugins/kubectx
parent1e615b71d636c3697d7e4aee8fbcd1dc01fd7da3 (diff)
downloadzsh-6396dfb97f13f5fbb0ef98cd5221600b89ff889a.tar.gz
zsh-6396dfb97f13f5fbb0ef98cd5221600b89ff889a.tar.bz2
zsh-6396dfb97f13f5fbb0ef98cd5221600b89ff889a.zip
fix(kubectx): don't error on missing k8s context (#10675)
Diffstat (limited to 'plugins/kubectx')
-rw-r--r--plugins/kubectx/kubectx.plugin.zsh4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
index 1419f102f..6096feeae 100644
--- a/plugins/kubectx/kubectx.plugin.zsh
+++ b/plugins/kubectx/kubectx.plugin.zsh
@@ -3,7 +3,9 @@ typeset -g -A kubectx_mapping
function kubectx_prompt_info() {
(( $+commands[kubectl] )) || return
- local current_ctx=$(kubectl config current-context)
+ local current_ctx=$(kubectl config current-context 2> /dev/null)
+
+ [[ -n "$current_ctx" ]] || return
# use value in associative array if it exists
# otherwise fall back to the context name