Skip to content

Instantly share code, notes, and snippets.

@andersonfraga
Created February 3, 2012 10:32
Show Gist options
  • Save andersonfraga/1729567 to your computer and use it in GitHub Desktop.
Save andersonfraga/1729567 to your computer and use it in GitHub Desktop.
FYI
export PATH=$HOME/local/bin:$PATH
#colors
export CLICOLOR=1
export LSCOLORS=GxFxCxDxegedabagaced
#customize output shel
parse_git_branch () {
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)#(git \1)#'
}
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print "(svn "$1 "/" $2 " #'$(parse_svn_version)')"}'
}
parse_svn_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
parse_svn_version() {
svn info 2>/dev/null | sed -ne 's#^Last Changed Rev: ##p'
}
parse_svn_repository_root() {
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
}
## if root, end with '#'\
if [ $(id -u) -eq 0 ]; then
PS1="[\t] \w \[\$(parse_git_branch)\$(parse_svn_branch)\] \]# "
else
PS1="[\t] \w \[\$(parse_git_branch)\$(parse_svn_branch)\] \]$ "
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment