Current Git and SVN Branch in Bash Prompt
I thought this was a wonderful idea add it to my own bash prompt.
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_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
parse_svn_repository_root() {
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
}
export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[\033[01;31m\]\$(parse_git_branch)\$(parse_svn_branch)\[\033[00m\]$ "
Читайте також:
- kerl - easy building and installing of Erlang/OTP instances
- Google Translate API From The Command Line
- Bash Completion on Mac OS X
- bash history - відображення дати і часу для кожної команди
- How To capture video from tv-tuner card via mencoder
- Shell script to convert .flac files to .mp3 format
- BASH key bindings
- Agner: a repository of libraries and applications
- QR-code erlang library
- etc snapshots with git