mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +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:
parent
44ea99e7b9
commit
22bda7799b
2 changed files with 44 additions and 12 deletions
|
|
@ -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/%/%%}}"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue