]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/kubectx/kubectx.plugin.zsh
6096feeae43d36b01df762b01f4327bd315f6cda
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / kubectx / kubectx.plugin.zsh
1 typeset -g -A kubectx_mapping
2
3 function kubectx_prompt_info() {
4   (( $+commands[kubectl] )) || return
5
6   local current_ctx=$(kubectl config current-context 2> /dev/null)
7
8   [[ -n "$current_ctx" ]] || return
9
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/%/%%}}"
13 }