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\]$ "
Читайте також:
- BASH key bindings
- Bash Completion on Mac OS X
- bash history - відображення дати і часу для кожної команди
- How To capture video from tv-tuner card via mencoder
- Google Translate API From The Command Line
- Shell script to convert .flac files to .mp3 format
- kerl - easy building and installing of Erlang/OTP instances
- Agner: a repository of libraries and applications
- etc snapshots with git
- QR-code erlang library