d87ab251c7fe18626b2d0c4e4a184e7bed7c508b

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(kubectx): quote % in `kubectx_prompt_info`

Diff

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