From 79d60f0f42a1df4f65ef1b1a930a6107000570fe Mon Sep 17 00:00:00 2001
From: William Giokas <1007380@gmail.com>
Date: Mon, 4 Mar 2013 02:29:50 -0600
Subject: scripts: Add color to pkgdelta

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
---
 scripts/pkgdelta.sh.in | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'scripts')

diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in
index f9b40c96..a6aad3f6 100644
--- a/scripts/pkgdelta.sh.in
+++ b/scripts/pkgdelta.sh.in
@@ -29,6 +29,7 @@ export TEXTDOMAINDIR='@localedir@'
 declare -r myver='@PACKAGE_VERSION@'
 
 QUIET=0
+USE_COLOR='y'
 
 # minimal of package before deltas are generated (bytes)
 min_pkg_size=$((1024*1024))
@@ -54,6 +55,7 @@ This delta file can then be added to a database using repo-add.\n\n")"
 	echo
 	printf -- "$(gettext "Options:\n")"
 	printf -- "$(gettext "  -q, --quiet       minimize output\n")"
+	printf -- "$(gettext "  --nocolor         remove color from output\n")"
 	printf -- "$(gettext "  --min-pkg-size    minimum package size before deltas are generated\n")"
 	printf -- "$(gettext "  --max-delta-size  percent of new package above which the delta will be discarded\n")"
 }
@@ -155,7 +157,7 @@ create_xdelta()
 }
 
 OPT_SHORT='hqV'
-OPT_LONG=('help' 'quiet' 'max-delta-size:' 'min-pkg-size:' 'version')
+OPT_LONG=('help' 'quiet' 'max-delta-size:' 'min-pkg-size:' 'nocolor' 'version')
 if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
 	exit 1
 fi
@@ -173,6 +175,8 @@ while :; do
 			exit 0 ;;
 		-q|--quiet)
 			QUIET=1;;
+		--nocolor)
+			USE_COLOR='n';;
 		--min-pkg-size)
 			if ! min_pkg_size=$(human_to_size "$2"); then
 				echo "invalid argument '$2' for option -- '$1'"
@@ -194,6 +198,8 @@ while :; do
 	shift
 done
 
+m4_include(library/term_colors.sh)
+
 if (( $# != 2 )); then
 	usage
 	exit 1
-- 
cgit v1.2.3-70-g09d2