Skip to content

Instantly share code, notes, and snippets.

@jethroo
Last active February 22, 2019 20:08
Show Gist options
  • Select an option

  • Save jethroo/6bdd1718a6b3883e0422a2e3f40f96f8 to your computer and use it in GitHub Desktop.

Select an option

Save jethroo/6bdd1718a6b3883e0422a2e3f40f96f8 to your computer and use it in GitHub Desktop.
COLUMNS=250
NORMAL="\[\033[00m\]"
YELLOW="\[\033[33m\]"
RED="\[\033[31m\]"
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "⚑️"
}
# show git branch
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
kube_ps1_color() {
local context=$(kubectl config current-context);
if [ -n "$context" ];
then
case "$context" in
*production*) echo -e "\033[31m" ;;
*staging*) echo -e "\033[33m" ;;
*third-being*) echo -e "\033[00m" ;;
esac
fi
}
kube_ps1_name() {
local context=$(kubectl config current-context);
if [ -n "$context" ];
then
case "$context" in
*production*) echo "πŸ¦‘ PRO πŸ•‹" ;;
*staging*) echo "πŸ™ STA πŸ•‹" ;;
*third-being*) echo "🦠 DEV πŸ•‹" ;;
esac
fi
}
export PS1="\[\$(kube_ps1_color)\]\$(kube_ps1_name) ${NORMAL}\h${YELLOW} \w ${RED}\$(parse_git_branch)${NORMAL}\$${NORMAL} "
ssh-add ~/.ssh/id_rsa
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/Workspace/liqid-infrastructure/bin"
stty echo
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment