-
-
Save Zenuncl/5105498 to your computer and use it in GitHub Desktop.
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
git_inspect_branch() { | |
git branch 2> /dev/null | grep ^* | sed 's/^\* \(.*\)$/:\1/g' | |
} | |
git_inspect_added() { | |
[[ $(git status 2> /dev/null | grep 'Untracked files:') != '' ]] && echo '+' | |
} | |
git_inspect_modified() { | |
[[ $(git status 2> /dev/null | grep 'modified:') != '' ]] && echo '*' | |
} | |
git_inspect_deleted() { | |
[[ $(git status 2> /dev/null | grep 'deleted:') != "" ]] && echo "-" | |
} | |
git_inspect_stash() { | |
[[ $(git stash list 2> /dev/null | grep 'stash@') != "" ]] && echo "?" | |
} | |
git_inspect_dirty() { | |
echo "$(git_inspect_added)$(git_inspect_modified)$(git_inspect_deleted)$(git_inspect_stash)" | |
} | |
NME="\u" | |
HST="\h" | |
DIR="\w" | |
PMT="\$" | |
RED="\[\033[31m\]" | |
GEN="\[\033[32m\]" | |
YEL="\[\033[33m\]" | |
OFF="\[\033[m\]" | |
MOD="\`if [ \$? = 0 ]; then echo 😃; else echo 😓; fi\`" # Mountain Lion only | |
# MOD="\`if [ \$? = 0 ]; then echo ':)'; else echo ':('; fi\`" # Other OSs | |
GIT="\`git_inspect_branch\`" | |
DIF="\`git_inspect_dirty\`" | |
PMT="\`if [ "$(id -u)" = "0" ]; then echo '#'; else echo '>'; fi\`" | |
PS1="$MOD $NME@$RED$HST$OFF:$DIR$GEN$GIT$OFF$RED$DIF$OFF$PMT " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment