From 81f945e2a5cee7995bb8521da5bad0ae91eb4aec Mon Sep 17 00:00:00 2001 From: William Giokas <1007380@gmail.com> Date: Mon, 4 Mar 2013 02:26:31 -0600 Subject: scripts: Add color to pacman-optimize Color enabled by default, use --nocolor to disable colored output. Signed-off-by: William Giokas <1007380@gmail.com> Signed-off-by: Allan McRae --- scripts/pacman-optimize.sh.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in index 53ae1c78..47fbb492 100644 --- a/scripts/pacman-optimize.sh.in +++ b/scripts/pacman-optimize.sh.in @@ -24,6 +24,8 @@ export TEXTDOMAIN='pacman-scripts' export TEXTDOMAINDIR='@localedir@' +USE_COLOR='y' + declare -r myver='@PACKAGE_VERSION@' eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf) @@ -33,7 +35,7 @@ m4_include(library/output_format.sh) usage() { printf "pacman-optimize (pacman) %s\n\n" "$myver" - printf -- "$(gettext "Usage: %s [pacman_db_root]")\n\n" "$0" + printf -- "$(gettext "Usage: %s [--nocolor] [pacman_db_root]")\n\n" "$0" printf -- "$(gettext "\ pacman-optimize is a little hack that should improve the performance\n\ of pacman when reading/writing to its filesystem-based database.\n\n")" @@ -84,6 +86,13 @@ if [[ $1 = "-V" || $1 = "--version" ]]; then exit 0 fi +if [[ $1 = "--nocolor" ]]; then + USE_COLOR='n' + shift +fi + +m4_include(library/term_colors.sh) + if [[ -n $1 ]]; then dbroot="$1" fi -- cgit v1.2.3-24-g4f1b