]> pd.if.org Git - zpackage/commitdiff
add -v option to log to write to stderr
authorNathan Wagner <nw@hydaspes.if.org>
Sat, 3 Nov 2018 12:33:32 +0000 (12:33 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sat, 3 Nov 2018 12:41:10 +0000 (12:41 +0000)
zpm-log

diff --git a/zpm-log b/zpm-log
index 8e53f6204060edffb64d0889cb2e62d61f35c993..1a0f9392eb458a1ea0d4f61caa0965c8d2e5ebd8 100755 (executable)
--- a/zpm-log
+++ b/zpm-log
@@ -8,10 +8,11 @@
 op=search
 action=
 json=0
+verbose=0
 
 pkgfile=${ZPMDB:-/var/lib/zpm/local.db}
 
-while getopts f:t:a:T:ij opt; do
+while getopts f:t:a:T:ijv opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
                t) target="$OPTARG" ;;
@@ -19,6 +20,7 @@ while getopts f:t:a:T:ij opt; do
                T) timestamp="$OPTARG" ;;
                i) op=insert ;;
                j) json=1 ;;
+               v) verbose=1 ;;
                *) printf '%s unknown option %s\n' "$0" "$opt" ; exit 1 ;;
        esac
 done
@@ -50,6 +52,10 @@ if [ $op = 'insert' ]; then
        printf ';\n'
 } | zpm shell $pkgfile
 
+if [ $verbose -ne 0 ]; then
+       printf "%s %s %s\n" "$action" "$target" "$*" 1>&2
+fi
+
 fi
 
 cols='ts,target,action,info'