summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Andersson <thesilentboatman@gmail.com>2015-02-08 23:24:57 +0100
committerAllan McRae <allan@archlinux.org>2015-02-12 13:45:03 +1000
commit68602f49316dd0c115805773da5825fae1cb8cdf (patch)
treef451dda102f7f4f0c51fb62474a1435d4e8dad19
parentdff6982c83e2db31b8a7925082fce7977eaed233 (diff)
paccache: added --quiet option
Less output, although errors and warnings will still be printed (scripts/library/output_format.sh). Cleaner to have -q,--quiet than >/dev/null in cron. Signed-off-by: Maxim Andersson <thesilentboatman@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--contrib/paccache.sh.in14
1 files changed, 10 insertions, 4 deletions
diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index 1690583e..02fae527 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -27,6 +27,7 @@ declare -a cachedirs=() candidates=() cmdopts=() whitelist=() blacklist=()
declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
declare delim=$'\n' keep=3 movedir= scanarch=
+QUIET=0
USE_COLOR='y'
m4_include(../scripts/library/output_format.sh)
@@ -135,6 +136,8 @@ runcmd() {
}
summarize() {
+ (( QUIET )) && return
+
local -i filecount=$1; shift
local seenarch= seen= arch= name=
local -r pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.pkg.*'
@@ -192,6 +195,7 @@ Usage: ${myname} <operation> [options] [targets...]
delimited.
-k, --keep <num> keep "num" of each package in the cache (default: 3).
--nocolor remove color from output.
+ -q, --quiet minimize output
-u, --uninstalled target uninstalled packages.
-v, --verbose increase verbosity. specify up to 3 times.
-z, --null use null delimiters for candidate names (only with -v
@@ -205,9 +209,9 @@ version() {
echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
}
-OPT_SHORT=':a:c:dfhi:k:m:rsuVvz'
+OPT_SHORT=':a:c:dfhi:k:m:qrsuVvz'
OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move'
- 'nocolor' 'remove' 'uninstalled' 'version' 'verbose' 'null')
+ 'nocolor' 'quiet' 'remove' 'uninstalled' 'version' 'verbose' 'null')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1
@@ -247,11 +251,13 @@ while :; do
keep=$(( 10#$keep ))
fi
shift ;;
- --nocolor)
- USE_COLOR='n' ;;
-m|--move)
move=1 movedir=$2
shift ;;
+ --nocolor)
+ USE_COLOR='n' ;;
+ -q|--quiet)
+ QUIET=1 ;;
-r|--remove)
delete=1 ;;
-u|--uninstalled)