[pacman-dev] [PATCH 3/5] pacdiff: add --nocolor option for the terminally challenged.

Jonathan Frazier eyeswide at gmail.com
Tue Jul 16 14:00:19 EDT 2013


Allow colors to be disabled for use on broken/serial terminals.

Signed-off-by: Jonathan Frazier <eyeswide at gmail.com>
---
 contrib/pacdiff.sh.in | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
index 52a2e7e..a39a02a 100644
--- a/contrib/pacdiff.sh.in
+++ b/contrib/pacdiff.sh.in
@@ -28,8 +28,6 @@ USE_COLOR='y'
 
 m4_include(../scripts/library/output_format.sh)
 
-m4_include(../scripts/library/term_colors.sh)
-
 usage() {
 	cat <<EOF
 $myname is a simple pacnew/pacorig/pacsave updater.
@@ -38,6 +36,7 @@ Usage: $myname [-l]
 
 Options:
   -l/--locate       scan using locate (default: find)
+  --nocolor         remove colors from output
 
 Enviroment Variables:
   DIFFPROG          override the merge program: (default: vimdiff)
@@ -67,6 +66,8 @@ while [[ -n "$1" ]]; do
 	case "$1" in
 		-l|--locate)
 		locate=1;;
+		--nocolor)
+		USE_COLOR='n' ;;
 		-V|--version)
 		version; exit 0;;
 		-h|--help)
@@ -77,6 +78,8 @@ while [[ -n "$1" ]]; do
 	shift
 done
 
+m4_include(../scripts/library/term_colors.sh)
+
 # see http://mywiki.wooledge.org/BashFAQ/020
 while IFS= read -u 3 -r -d '' pacfile; do
 	file="${pacfile%.pac*}"
-- 
1.8.3.2



More information about the pacman-dev mailing list