Created
June 27, 2013 06:26
-
-
Save kirillzubovsky/5874367 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
CYN='\e[1;96m' | |
# git dirty branch | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "(._.)" | |
} | |
function parse_git_clean { | |
[[ $(git status 2> /dev/null | tail -n1) == "nothing to commit (working directory clean)" ]] && echo "(>_<)" | |
} | |
# branch in PS | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
PS1="$RED\$(date +%H:%M) \w$YELLOW \$(parse_git_branch) $CYN\$(parse_git_dirty)\$(parse_git_clean)$GREEN$\[\e[0m\] " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment