1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-06 07:20:40 +01:00

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>
This commit is contained in:
Marc Cornellà
2024-08-01 10:00:58 +02:00
parent 44ea99e7b9
commit 22bda7799b
2 changed files with 44 additions and 12 deletions

View File

@@ -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/%/%%}}"
}