]> pd.if.org Git - zpackage/blobdiff - zpm-list
refactor syncconflicts view for performance
[zpackage] / zpm-list
index 0dda9daa68223dfd0ec231a6c8e014e5d1f41d65..c10ace4ec1028b641fa25b95c3a022f89d5b8e4f 100755 (executable)
--- a/zpm-list
+++ b/zpm-list
@@ -4,18 +4,21 @@
 
 verbose=0
 nameonly=0
+latestonly=1
 
-while getopts :s:f:vn opt; do
+while getopts :s:f:vnI opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
                s) status="$OPTARG" ;;
+               I) status=installed ;;
                v) verbose=1 ;;
                n) nameonly=1 ;;
+               a) latestonly=0 ;;
        esac
 done
 shift $(( OPTIND - 1))
 
-: ${pkgfile:=$ZPMDB}
+: ${pkgfile:=${ZPMDB:-/var/lib/zpm/local.db}}
 
 if [ -z "$pkgfile" ]; then
        echo "must specify package file"
@@ -34,7 +37,7 @@ fi
 
 if [ -n "$status" ]; then
        status=$(zpm quote "$status")
-       where="where status = '$status'"
+       where="and status = '$status'"
 fi
 
 pkgid=$1
@@ -57,6 +60,10 @@ fi
 
 zpm shell $pkgfile <<EOS
 .separator "\t"
-select $cols from packages_pkgid $where
+select $cols from packages_pkgid where true $where
 ;
 EOS
+
+if [ $? -ne 0 ]; then
+       echo "select $cols from packages_pkgid where true $where" 1>&2
+fi