summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2022-01-03 14:03:36 +0100
committerMarc Cornellà <hello@mcornella.com>2022-01-03 14:03:36 +0100
commitd87ab251c7fe18626b2d0c4e4a184e7bed7c508b (patch)
tree4ad1ab57061fee4b4b8c1c1c55ba6cbe666b7e38 /plugins
parenta280726d934878a31f6dae35d8677a53551bbcf5 (diff)
downloadzsh-d87ab251c7fe18626b2d0c4e4a184e7bed7c508b.tar.gz
zsh-d87ab251c7fe18626b2d0c4e4a184e7bed7c508b.tar.bz2
zsh-d87ab251c7fe18626b2d0c4e4a184e7bed7c508b.zip
fix(kubectx): quote % in `kubectx_prompt_info`
Diffstat (limited to 'plugins')
-rw-r--r--plugins/kubectx/kubectx.plugin.zsh12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
index abbdc254b..af9a17ef1 100644
--- a/plugins/kubectx/kubectx.plugin.zsh
+++ b/plugins/kubectx/kubectx.plugin.zsh
@@ -1,9 +1,11 @@
typeset -A kubectx_mapping
function kubectx_prompt_info() {
- if [ $commands[kubectl] ]; then
- local current_ctx=`kubectl config current-context`
- # use value in associative array if it exists, otherwise fall back to the context name
- echo "${kubectx_mapping[$current_ctx]:-$current_ctx}"
- fi
+ (( $+commands[kubectl] )) || return
+
+ local current_ctx=$(kubectl config current-context)
+
+ # use value in associative array if it exists
+ # otherwise fall back to the context name
+ echo "${${kubectx_mapping[$current_ctx]:-$current_ctx}:gs/%/%%}"
}