kubectx.plugin.zsh 318 B

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