File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ the following variables:
197197| ` KUBE_PS1_SUFFIX ` | ` ) ` | Prompt closing character |
198198| ` KUBE_PS1_CLUSTER_FUNCTION ` | No default, must be user supplied | Function to customize how cluster is displayed |
199199| ` KUBE_PS1_NAMESPACE_FUNCTION ` | No default, must be user supplied | Function to customize how namespace is displayed |
200+ | ` KUBE_PS1_HIDE_IF_NOCONTEXT ` | ` false ` | Hide the kube-ps1 prompt if no context is set |
200201
201202To disable a feature, set it to an empty string:
202203
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}"
3434KUBE_PS1_DIVIDER=" ${KUBE_PS1_DIVIDER-: } "
3535KUBE_PS1_SUFFIX=" ${KUBE_PS1_SUFFIX-)} "
3636
37+ KUBE_PS1_HIDE_IF_NOCONTEXT=" ${KUBE_PS1_HIDE_IF_NOCONTEXT:- false} "
38+
3739_KUBE_PS1_KUBECONFIG_CACHE=" ${KUBECONFIG} "
3840_KUBE_PS1_DISABLE_PATH=" ${HOME} /.kube/kube-ps1/disabled"
3941_KUBE_PS1_LAST_TIME=0
@@ -376,6 +378,8 @@ kubeoff() {
376378kube_ps1 () {
377379 [[ " ${KUBE_PS1_ENABLED} " == " off" ]] && return
378380 [[ -z " ${KUBE_PS1_CONTEXT} " ]] && [[ " ${KUBE_PS1_CONTEXT_ENABLE} " == true ]] && return
381+ [[ " ${KUBE_PS1_CONTEXT} " == " N/A" ]] && [[ ${KUBE_PS1_HIDE_IF_NOCONTEXT} == false ]] && return
382+
379383
380384 local KUBE_PS1
381385 local KUBE_PS1_RESET_COLOR=" ${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC} "
You can’t perform that action at this time.
0 commit comments