31d63ea884e8ef56a40bed8771cdd8d3aec131f9

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(kubectx): allow prompt sequences in `kubectx_mapping` (#10562)

Fixes #10562

Diff

 1diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
 2index af9a17ef1f164f5cdfe8fe543bfae8fcc1a08cbe..1419f102f733cd5d96de797137cbda57a2d153ba 100644
 3--- a/plugins/kubectx/kubectx.plugin.zsh
 4+++ b/plugins/kubectx/kubectx.plugin.zsh
 5@@ -1,4 +1,4 @@
 6-typeset -A kubectx_mapping
 7+typeset -g -A kubectx_mapping
 8 
 9 function kubectx_prompt_info() {
10   (( $+commands[kubectl] )) || return
11@@ -7,5 +7,5 @@ function kubectx_prompt_info() {
12 
13   # use value in associative array if it exists
14   # otherwise fall back to the context name
15-  echo "${${kubectx_mapping[$current_ctx]:-$current_ctx}:gs/%/%%}"
16+  echo "${kubectx_mapping[$current_ctx]:-${current_ctx:gs/%/%%}}"
17 }