[pacman-dev] [PATCH 6/7] scripts: add color to pkgdelta

William Giokas 1007380 at gmail.com
Sat Mar 2 16:51:01 EST 2013


Use color by default. -m and --no-color disable colorized printing.

Signed-off-by: William Giokas <1007380 at gmail.com>
---
 scripts/pkgdelta.sh.in | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in
index f9b40c9..36c3383 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 "  -m, --no-color    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")"
 }
@@ -173,6 +175,8 @@ while :; do
 			exit 0 ;;
 		-q|--quiet)
 			QUIET=1;;
+		-m|--no-color)
+			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
-- 
1.8.2.rc1.24.g06d67b8



More information about the pacman-dev mailing list