1 typeset -g -A kubectx_mapping
3 function kubectx_prompt_info() {
4 (( $+commands[kubectl] )) || return
6 local current_ctx=$(kubectl config current-context 2> /dev/null)
8 [[ -n "$current_ctx" ]] || return
10 # use value in associative array if it exists
11 # otherwise fall back to the context name
12 echo "${kubectx_mapping[$current_ctx]:-${current_ctx:gs/%/%%}}"