fix(kubectx): show plain context if not mapped (#10134)
Diff
1diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
2index 56b7217f1bc26d3fd1bbfdd153425ffd35d93039..abbdc254beab0f64eb650003d5125001fc8f8799 100644
3--- a/plugins/kubectx/kubectx.plugin.zsh
4+++ b/plugins/kubectx/kubectx.plugin.zsh
5@@ -3,12 +3,7 @@ typeset -A kubectx_mapping
6 function kubectx_prompt_info() {
7 if [ $commands[kubectl] ]; then
8 local current_ctx=`kubectl config current-context`
9-
10- #if associative array declared
11- if [[ -n $kubectx_mapping ]]; then
12- echo "${kubectx_mapping[$current_ctx]}"
13- else
14- echo $current_ctx
15- fi
16+ # use value in associative array if it exists, otherwise fall back to the context name
17+ echo "${kubectx_mapping[$current_ctx]:-$current_ctx}"
18 fi
19 }