summaryrefslogtreecommitdiffstats
path: root/scripts/pacman-optimize.sh.in
diff options
context:
space:
mode:
authorWilliam Giokas <1007380@gmail.com>2013-03-04 09:26:31 +0100
committerAllan McRae <allan@archlinux.org>2013-03-08 08:04:39 +0100
commit81f945e2a5cee7995bb8521da5bad0ae91eb4aec (patch)
tree2ec9ab33780b19dcc33b4012754f64670b0903c0 /scripts/pacman-optimize.sh.in
parent9d99914a1893566ffdfcb53ecb894aba3737988e (diff)
downloadpacman-81f945e2a5cee7995bb8521da5bad0ae91eb4aec.tar.gz
pacman-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/pacman-optimize.sh.in')
-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