Last active
November 11, 2018 13:08
-
-
Save acidDrain/9cdec769ce9f4a20ffd475dcbfc54ef7 to your computer and use it in GitHub Desktop.
Bash prompt that includes current Kubernetes context and current git branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_branch() { | |
git branch 2> /dev/null | grep "^\*" | sed -e 's/\(\* \)\(.*\)/\(\2\)/g' | |
} | |
export PS1="\[\e[97m\][\$(kubectl config current-context 2> /dev/null )]\[\e[39m\] \$USER@\$HOSTNAME:\[\e[38;5;226m\]\w\[\e[39m\]\[\e[96m\] \$(parse_git_branch)\[\e[0m\]$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment