Skip to content

Instantly share code, notes, and snippets.

@gbaptista
Last active September 8, 2019 00:28
Show Gist options
  • Save gbaptista/9fe2c11c5f2b155238d9d5f44eafb7b6 to your computer and use it in GitHub Desktop.
Save gbaptista/9fe2c11c5f2b155238d9d5f44eafb7b6 to your computer and use it in GitHub Desktop.
LIGHTBLUE="\[\033[1;34m\]"
LIGHTRED="\[\033[1;31m\]"
WHITE="\[\033[1;37m\]"
ORANGE="\[\033[38;5;172m\]"
NO_COLOR="\[\033[0m\]"
function k8sNamespace() {
printf $(kubectl config view -o=jsonpath='{.contexts[0].context.namespace}')
}
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PROMPT_DIRTRIM=2
PS1="$LIGHTBLUE$(whoami)$WHITE @ $NO_COLOR\w $LIGHTRED[\$(k8sNamespace)]$ORANGE\$(parse_git_branch)$NO_COLOR \$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment