2021-06-13 15:23:13 +00:00
|
|
|
typeset -A kubectx_mapping
|
|
|
|
|
|
|
|
function kubectx_prompt_info() {
|
2022-01-03 13:03:36 +00:00
|
|
|
(( $+commands[kubectl] )) || return
|
|
|
|
|
|
|
|
local current_ctx=$(kubectl config current-context)
|
|
|
|
|
|
|
|
# use value in associative array if it exists
|
|
|
|
# otherwise fall back to the context name
|
|
|
|
echo "${${kubectx_mapping[$current_ctx]:-$current_ctx}:gs/%/%%}"
|
2021-06-13 15:23:13 +00:00
|
|
|
}
|