]> pd.if.org Git - zpackage/commitdiff
add verbose option to contents
authorNathan Wagner <nw@hydaspes.if.org>
Sun, 30 Sep 2018 15:28:08 +0000 (15:28 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sun, 30 Sep 2018 15:28:08 +0000 (15:28 +0000)
zpm-contents

index 3d1d13fc29ca93f08fb63bc9e1d91942f068afc1..79fc2935c5ffec267e6b36eae08851f121aedca4 100755 (executable)
@@ -2,9 +2,12 @@
 
 pkgfile=${ZPMDB:-/var/lib/zpm/db.zpm}
 
-while getopts f: opt; do
+verbose=0
+
+while getopts f:v opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
+               v) verbose=1
        esac
 done
 shift $((OPTIND - 1))
@@ -16,16 +19,25 @@ if [ ! -f $pkgfile ]; then
        exit 1
 fi
 
+cols=
+if [ $verbose -gt 0 ]; then
+       cols='filetype,mode,username,groupname,'
+fi
 
 for pkg in "$@"; do
        pkgid=$(zpm findpkg -f $pkgfile $pkg)
 
        zpm shell $pkgfile <<EOS
-.separator "\t"
-select package, version, release,
-path || case when hash is null then '/' else '' end
-from packagefiles
-where printf('%s-%s-%s', package,version,release) = '$pkgid'
+.separator " "
+select pkgid, $cols
+case when filetype = 'd' then
+       rtrim(path,'/') || '/'
+else
+       path
+end as path
+from packagefiles_pkgid
+where pkgid = '$pkgid'
+order by path
 ;
 EOS