summaryrefslogtreecommitdiff
path: root/plugins/kubectx/kubectx.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kubectx/kubectx.plugin.zsh')
-rw-r--r--plugins/kubectx/kubectx.plugin.zsh8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
index a3210facc..f1ca990ad 100644
--- a/plugins/kubectx/kubectx.plugin.zsh
+++ b/plugins/kubectx/kubectx.plugin.zsh
@@ -7,7 +7,9 @@ function kubectx_prompt_info() {
[[ -n "$current_ctx" ]] || return
- # use value in associative array if it exists
- # otherwise fall back to the context name
- echo "${kubectx_mapping[\"$current_ctx\"]:-${current_ctx:gs/%/%%}}"
+ # Use value in associative array if it exists, otherwise fall back to the context name
+ #
+ # Note: we need to escape the % character in the prompt string when coming directly from
+ # the context name, as it could contain a % character.
+ echo "${kubectx_mapping[$current_ctx]:-${current_ctx:gs/%/%%}}"
}