better command check for kubectl
This commit is contained in:
parent
e97d09e7d9
commit
84a8aa1ed5
@ -48,7 +48,7 @@ function bash_ps1 () {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[[ -n "$VIRTUAL_ENV" ]] && PYTHON_ENV="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_VENV}${VIRTUAL_ENV##*/}${PS1_COLOR_DIVIDER}]"
|
[[ -n "$VIRTUAL_ENV" ]] && PYTHON_ENV="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_VENV}${VIRTUAL_ENV##*/}${PS1_COLOR_DIVIDER}]"
|
||||||
if [[ $(type kubectl) ]]; then
|
if command -v kubectl > /dev/null; then
|
||||||
CURRENT_CONTEXT="$(kubectl config current-context 2>/dev/null)"
|
CURRENT_CONTEXT="$(kubectl config current-context 2>/dev/null)"
|
||||||
if [[ "$CURRENT_CONTEXT" != "default" ]];then
|
if [[ "$CURRENT_CONTEXT" != "default" ]];then
|
||||||
K8S_CURRENT_CONTEXT="${PS1_COLOR_DIVIDER}[${PS1_COLOR_KUBERNETES}${CURRENT_CONTEXT}${PS1_COLOR_DIVIDER}]"
|
K8S_CURRENT_CONTEXT="${PS1_COLOR_DIVIDER}[${PS1_COLOR_KUBERNETES}${CURRENT_CONTEXT}${PS1_COLOR_DIVIDER}]"
|
||||||
|
Loading…
Reference in New Issue
Block a user