better command check for kubectl

This commit is contained in:
Jonas Forsberg 2022-07-08 09:32:49 +02:00
parent e97d09e7d9
commit 84a8aa1ed5
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9

View File

@ -48,7 +48,7 @@ function bash_ps1 () {
fi
fi
[[ -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)"
if [[ "$CURRENT_CONTEXT" != "default" ]];then
K8S_CURRENT_CONTEXT="${PS1_COLOR_DIVIDER}[${PS1_COLOR_KUBERNETES}${CURRENT_CONTEXT}${PS1_COLOR_DIVIDER}]"