summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorWilliam Giokas <1007380@gmail.com>2013-03-04 02:26:31 -0600
committerAllan McRae <allan@archlinux.org>2013-03-08 17:04:39 +1000
commit81f945e2a5cee7995bb8521da5bad0ae91eb4aec (patch)
tree2ec9ab33780b19dcc33b4012754f64670b0903c0 /scripts
parent9d99914a1893566ffdfcb53ecb894aba3737988e (diff)
downloadpacman-81f945e2a5cee7995bb8521da5bad0ae91eb4aec.tar.xz
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 <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pacman-optimize.sh.in11
1 files changed, 10 insertions, 1 deletions
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