From c2e217770524b43145b65774e058d423cc167336 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Fri, 7 Dec 2018 16:18:38 +0000 Subject: [PATCH] warn on all missing packages --- doc/zpm-contents.8 | 21 ++++++++++++++------- zpm-contents | 22 +++++++++++----------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/doc/zpm-contents.8 b/doc/zpm-contents.8 index 4cdb964..4ac9c15 100644 --- a/doc/zpm-contents.8 +++ b/doc/zpm-contents.8 @@ -7,18 +7,25 @@ zpm-contents \- list files in a zpm package .BI -f " pkgfile" ] [ -.I package ... -] -[ -.B -- -.I fileglob ... +.B -ln ] +.RI [ package ...] +.RB [ -- +.IR glob ...\fR] .SH DESCRIPTION -zpm-contents lists files belonging to any of the given packages, +\fBzpm-contents\fR lists files belonging to any of the given packages, or all packages. Additionally, the list of packages can be terminated with '--' and any additional arguments are glob patterns. .SH OPTIONS -\-f specify the package file to find packages in +.TP +\-f +specify the package file to find packages in +.TP +\-n +list file paths only +.TP +\-l +long listing, with file mode and ownership, overrides \-n .SH EXAMPLES zpm contents .SH EXIT STATUS diff --git a/zpm-contents b/zpm-contents index 18fac94..60ec1f5 100755 --- a/zpm-contents +++ b/zpm-contents @@ -41,28 +41,28 @@ elif [ $quiet -eq 0 ]; then fi pkglist= +efail=0 while [ $# -gt 0 ]; do pkg=$1 shift + if [ "$pkg" = '--' ]; then - break; + break fi pkgid=$(zpm findpkg -f $pkgfile "$pkg") if [ -n "$pkgid" ]; then - q=$(zpm quote -q "$pkgid") - pkglist=",$q" + pkglist="$pkglist $pkgid" else - printf "package $pkg not found, ignoring\n" 1>&2 - exit 1 - fi - pkglist=${pkglist#,} - if [ -z "$pkglist" ]; then - printf "can't find any packages\n" 1>&2 - exit 1 + printf "package $pkg not found\n" 1>&2 + efail=1 fi done +if [ $efail -eq 1 ]; then + exit 1; +fi + globlist= for glob in "$@"; do q=$(zpm quote -q "$glob") @@ -102,7 +102,7 @@ cols=${cols%,} printf "and (%s)\n" "$globlist" fi if [ -n "$pkglist" ]; then - printf "and pkgid in (%s)\n" "$pkglist" + printf "and pkgid in (%s)\n" "$(zpm quote -d, -q $pkglist)" fi case $config in only) printf "and configuration = 1\n" ;; -- 2.40.0