diff options
author | Erich Eckner <erich.eckner.ext@bestsecret.com> | 2024-05-17 13:40:58 +0200 |
---|---|---|
committer | Erich Eckner <erich.eckner.ext@bestsecret.com> | 2024-05-17 13:40:58 +0200 |
commit | a2dab1fce231c5c0cfe1aa809ea0e567be79160a (patch) | |
tree | 1bbaa02bece14b3356d6e0b1e95eaf8681bf0a61 /bash-git-prompt.in | |
parent | fa8f6db09f0496adf419f7aa3391a5788d63514d (diff) | |
download | bash-git-prompt-a2dab1fce231c5c0cfe1aa809ea0e567be79160a.tar.xz |
track kubernetes context, too
Diffstat (limited to 'bash-git-prompt.in')
-rwxr-xr-x | bash-git-prompt.in | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bash-git-prompt.in b/bash-git-prompt.in index acc1a59..14640b9 100755 --- a/bash-git-prompt.in +++ b/bash-git-prompt.in @@ -14,6 +14,23 @@ PS1="$PS1Start" . #ETCDIR#/bash-git-prompt.conf +if currentContext=$(kubectl config current-context 2>/dev/null) \ +&& [ -n "${currentContext}" ]; then + if $mitFarbe; then + if toPrint=$(echo "${currentContext}" | grep -o -- "${kubectxRegExProd}"); then + PS1="$PS1\[\033[01;31m\]" + elif toPrint=$(echo "${currentContext}" | grep -o -- "${kubectxRegExDev}"); then + PS1="$PS1\[\033[01;34m\]" + else + toPrint="${currentContext}" + fi + fi + PS1="$PS1 ${toPrint}" + if $mitFarbe; then + PS1="$PS1\[\033[00m\]" + fi +fi + skip=false if [ -n "${skipDirRegEx}" ] && pwd | grep -q "${skipDirRegEx}" &> /dev/null then |