Skip to content

Instantly share code, notes, and snippets.

@koenighotze
Created March 6, 2018 10:45
Show Gist options
  • Save koenighotze/9cdc60c85eec9fec5ecae8da0bb32ad0 to your computer and use it in GitHub Desktop.
Save koenighotze/9cdc60c85eec9fec5ecae8da0bb32ad0 to your computer and use it in GitHub Desktop.
function kube_context() {
# could have used $?, but it was easier with a string compare
local ctx=$(kubectl config current-context 2>&1)
if [ "${ctx}" != "error: current-context is not set" ]; then
echo -n "<${ctx}> "
fi
}
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
}
export PS1='\[\033]0;\u@\h:\w\007\]\[\e[1;33m\]\u\[\e[0m\]@\[\e[1;35m\]\h \[\e[0m\]in \[\e[0;32m\]\w \[\e[0m\][\[\e[1;35m\]$(parse_git_branch)\[\e[0m\]] (\[\e[32m\]☁ $AWS_PROFILE\[\e[0m\]/\[\e[32m\]$AWS_DEFAULT_REGION\[\e[m\]) \[\e[1;35m\]$(kube_context) \n\[\e[0m\]\[\e[37m\]$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment