From 60d632bbb9adcc39a35772b5fd07df8640592dc8 Mon Sep 17 00:00:00 2001 From: Tony Duckles Date: Sat, 13 Jul 2013 10:16:17 -0500 Subject: [PATCH] bin/svn-wrapper: Colorized diff output --- bin/svn-wrapper | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/svn-wrapper b/bin/svn-wrapper index f46c149..f2c3287 100755 --- a/bin/svn-wrapper +++ b/bin/svn-wrapper @@ -98,15 +98,24 @@ function strip(str) { msg = ""; } printf("'${yellow}'%s'${std}' %s '${lblack}'(by %s, %s)'${std}'\n", revnum, msg, author, date); -}; -' +};' + +awk_svn_diff=' +{ str=$0; + if (substr(str,1,1) == "@") { str = sprintf("'${lpurple}'%s'${std}'", str); } + if (substr(str,1,1) == "-") { str = sprintf("'${lred}'%s'${std}'", str); } + if (substr(str,1,1) == "+") { str = sprintf("'${lgreen}'%s'${std}'", str); } + if (substr(str,1,1) == "=") { str = sprintf("'${lblue}'%s'${std}'", str); } + if (substr(str,1,1) == "I") { str = sprintf("\n'${lblue}'%s'${std}'", str); } + print str; +};' case $1 in cat) exec svn "$@" | $PAGER ;; diff) - exec svn "$@" | $PAGER + exec svn "$@" | awk "${awk_svn_diff}" | $PAGER ;; help) exec svn "$@" | $PAGER -- 2.47.1