Skip to content

Instantly share code, notes, and snippets.

@eproxus
Last active December 18, 2015 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eproxus/5803791 to your computer and use it in GitHub Desktop.
Save eproxus/5803791 to your computer and use it in GitHub Desktop.
Colored SVN status and log output, page long commands.
svn() {
# Exit if no command was specified
if [ $# -lt 1 ]; then
command svn
return
fi
local cmd=$1
shift
if [[ $cmd =~ ^(status|stat|st)$ ]]; then
command svn $cmd "$@" | \
colout "^[MAR]" green | \
colout "^\!.*" yellow | \
colout "^D" red | \
colout "^\?.*" black | \
colout "^\s*\*.*" blue
elif [[ $cmd =~ ^(blame|help|h|cat)$ ]]; then
command svn $cmd "$@" | less -RF
elif [[ $cmd == log ]]; then
command svn $cmd "$@" | \
colout "^-+\$" black | \
colout \
"^(r\d+)\s+(\|)\s+([^|]+)\s+(\|)\s+([^|]+)\s+(\|)\s+([^|]+)" \
blue,black,green,black,white,black,red normal,bold,normal | \
less -RF
else
command svn $cmd "$@"
fi
}

SVN Colors

Colored SVN status and log output, page long commands.

Dependencies

Installation

Copy svn.sh contents into your .bashrc / .zshrc or clone and add the following line instead:

source ~/path/to/svn.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment