mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
fix(kubectx): fix kubectx_prompt_info for contexts without spaces.
This commit is contained in:
parent
c432ca0993
commit
4f71026266
1 changed files with 10 additions and 1 deletions
|
|
@ -9,5 +9,14 @@ function kubectx_prompt_info() {
|
||||||
|
|
||||||
# use value in associative array if it exists
|
# use value in associative array if it exists
|
||||||
# otherwise fall back to the context name
|
# otherwise fall back to the context name
|
||||||
echo "${kubectx_mapping[\"$current_ctx\"]:-${current_ctx:gs/%/%%}}"
|
|
||||||
|
local mapped_ctx
|
||||||
|
|
||||||
|
if [[ $current_ctx =~ " " ]]; then
|
||||||
|
mapped_ctx="${kubectx_mapping[\"$current_ctx\"]}"
|
||||||
|
else
|
||||||
|
mapped_ctx="${kubectx_mapping[$current_ctx]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${mapped_ctx:-${current_ctx:gs/%/%%}}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue