[pacman-dev] [PATCHv2 03/10] script: add color to pacman-db-upgrade
William Giokas
1007380 at gmail.com
Sun Mar 3 13:48:18 EST 2013
Use color by default, -m/--no-color turns off colors.
Signed-off-by: William Giokas <1007380 at gmail.com>
---
scripts/pacman-db-upgrade.sh.in | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in
index 1b5407a..edd41db 100644
--- a/scripts/pacman-db-upgrade.sh.in
+++ b/scripts/pacman-db-upgrade.sh.in
@@ -28,11 +28,13 @@ declare -r myver='@PACKAGE_VERSION@'
eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
dbroot="${DBPath:- at localstatedir@/lib/pacman/}"
+USE_COLOR='y'
+
m4_include(library/output_format.sh)
usage() {
printf "pacman-db-upgrade (pacman) %s\n\n" "$myver"
- printf -- "$(gettext "Usage: %s [pacman_db_root]")\n\n" "$0"
+ printf -- "$(gettext "Usage: %s [-m|--no-color] [pacman_db_root]")\n\n" "$0"
}
version() {
@@ -72,6 +74,13 @@ if [[ $1 = "-V" || $1 = "--version" ]]; then
exit 0
fi
+if [[ $1 = "-m" || $1 = "--no-color" ]]; then
+ USE_COLOR='n'
+ shift
+fi
+
+m4_include(library/term_colors.sh)
+
if [[ -n $1 ]]; then
dbroot="$1"
fi
--
1.8.2.rc1.24.g06d67b8
More information about the pacman-dev
mailing list