[pacman-dev] [PATCH] 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> --- contrib/paccache.sh.in | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in index 1690583..02fae52 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) -- 2.3.0
On 08.02.2015 23:24, Maxim Andersson wrote:
Cleaner to have -q,--quiet than >/dev/null in cron.
You should look into using chronic from moreutils. It captures stdout/stderr and only outputs them again if the exit code != 0 (which I hope holds for paccache if it encounters errors). You really want all the output you can get in the error case for easier debugging (especially if you can't reproduce the error). That said I don't care if this goes in. ±0
2015-02-08 23:32 GMT+01:00 Florian Pritz <bluewind@xinu.at>:
On 08.02.2015 23:24, Maxim Andersson wrote:
Cleaner to have -q,--quiet than >/dev/null in cron.
You should look into using chronic from moreutils. It captures stdout/stderr and only outputs them again if the exit code != 0 (which I hope holds for paccache if it encounters errors).
Sounds like a neat tool. I hadn't heard about before, but I will definitively check it out. But in paccaches case the output would be pretty much the same, as there is (almost) no output before the potential errors could occur. // Maxim
You really want all the output you can get in the error case for easier debugging (especially if you can't reproduce the error).
That said I don't care if this goes in. ±0
On 09/02/15 08:24, Maxim Andersson wrote:
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> --- contrib/paccache.sh.in | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
This is fine. A
participants (3)
-
Allan McRae
-
Florian Pritz
-
Maxim Andersson