]> pd.if.org Git - zpackage/blobdiff - zpm-log
let newpackage set additional fields
[zpackage] / zpm-log
diff --git a/zpm-log b/zpm-log
index 8e53f6204060edffb64d0889cb2e62d61f35c993..441d15709930da7093491cf6ed43aeb4202cf7d5 100755 (executable)
--- a/zpm-log
+++ b/zpm-log
@@ -8,10 +8,13 @@
 op=search
 action=
 json=0
+verbose=0
 
 pkgfile=${ZPMDB:-/var/lib/zpm/local.db}
 
-while getopts f:t:a:T:ij opt; do
+order=asc
+
+while getopts f:t:a:T:ijvr opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
                t) target="$OPTARG" ;;
@@ -19,6 +22,8 @@ while getopts f:t:a:T:ij opt; do
                T) timestamp="$OPTARG" ;;
                i) op=insert ;;
                j) json=1 ;;
+               v) verbose=1 ;;
+               r) order=desc ;;
                *) printf '%s unknown option %s\n' "$0" "$opt" ; exit 1 ;;
        esac
 done
@@ -50,6 +55,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'
@@ -73,7 +82,7 @@ fi
        if [ -n "$target" ]; then
                printf "target like '%s' and " "$target"
        fi
-       printf "true order by ts;\n"
+       printf "true order by ts $order;\n"
 } | zpm shell $pkgfile
 
 fi