diff options
| author | Marc Cornellà <marc@mcornella.com> | 2024-08-01 10:00:58 +0200 |
|---|---|---|
| committer | Marc Cornellà <marc@mcornella.com> | 2024-08-01 10:00:58 +0200 |
| commit | 22bda7799b1e1500a701e1a55a189c77119e9e5f (patch) | |
| tree | 07e0d66029c366035e23bbc25232cad742c82e85 /plugins/kubectx/kubectx.plugin.zsh | |
| parent | 44ea99e7b9536a94da60397a2b0fc1a0c8457f96 (diff) | |
| download | zsh-22bda7799b1e1500a701e1a55a189c77119e9e5f.tar.gz zsh-22bda7799b1e1500a701e1a55a189c77119e9e5f.tar.bz2 zsh-22bda7799b1e1500a701e1a55a189c77119e9e5f.zip | |
fix(kubectx): fix display of k8s contexts without double quotes (#12534)
BREAKING CHANGE: the `kubectx` plugin now properly displays contexts from the
kubectx_mapping array, without using double quotes. Please refer to the plugin
README to see how to use it properly.
Closes #12534
Co-authored-by: Ken Kelly <ken@kenhkelly.us>
Diffstat (limited to 'plugins/kubectx/kubectx.plugin.zsh')
| -rw-r--r-- | plugins/kubectx/kubectx.plugin.zsh | 8 |
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/%/%%}}" } |
