Created
June 22, 2010 04:03
-
-
Save BinaryMuse/447949 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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1$(parse_git_stash))/" | |
} | |
parse_git_stash() { | |
git stash list 2> /dev/null | wc -l | sed -e "s/ *\([0-9]*\)/\ \+\1/g" | sed -e "s/ \+0//" | |
} | |
parse_svn_branch() { | |
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print " ("$1 "/" $2 ")"}' | |
} | |
parse_svn_url() { | |
svn info 2>/dev/null | grep -e '^URL*' | sed -e 's#^URL: *\(.*\)#\1#g ' | |
} | |
parse_svn_repository_root() { | |
svn info 2>/dev/null | grep -e '^Repository Root:*' | sed -e 's#^Repository Root: *\(.*\)#\1\/#g ' | |
} | |
export PS1="[\u \w\$(parse_git_branch)\$(parse_svn_branch)]: " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment