diff options
author | Mattias Öhrn <mattias.ohrn@gmail.com> | 2021-08-24 19:19:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 19:19:29 +0200 |
commit | e13ff75f38200b03b26f798991b3ecf30e547d82 (patch) | |
tree | 7a63aa3939264930cd8d68260fd24646a9a50641 /plugins/kubectx | |
parent | 6d5b8484ce7198161d5f617c3db9fd7d3833d48c (diff) | |
download | zsh-e13ff75f38200b03b26f798991b3ecf30e547d82.tar.gz zsh-e13ff75f38200b03b26f798991b3ecf30e547d82.tar.bz2 zsh-e13ff75f38200b03b26f798991b3ecf30e547d82.zip |
fix(kubectx): show plain context if not mapped (#10134)
Diffstat (limited to 'plugins/kubectx')
-rw-r--r-- | plugins/kubectx/kubectx.plugin.zsh | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh index 56b7217f1..abbdc254b 100644 --- a/plugins/kubectx/kubectx.plugin.zsh +++ b/plugins/kubectx/kubectx.plugin.zsh @@ -3,12 +3,7 @@ typeset -A kubectx_mapping function kubectx_prompt_info() { if [ $commands[kubectl] ]; then local current_ctx=`kubectl config current-context` - - #if associative array declared - if [[ -n $kubectx_mapping ]]; then - echo "${kubectx_mapping[$current_ctx]}" - else - echo $current_ctx - fi + # use value in associative array if it exists, otherwise fall back to the context name + echo "${kubectx_mapping[$current_ctx]:-$current_ctx}" fi } |