From 2d68981ca37065bdf1b60debf94d5fedaeff1afe Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 9 Sep 2019 11:17:59 +0300 Subject: [PATCH] pkg_list: simplify --- kiss | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/kiss b/kiss index 776d826..e3bed40 100755 --- a/kiss +++ b/kiss @@ -95,20 +95,15 @@ pkg_list() { # packages installed. [ "$1" = "$KISS_ROOT/$pkg_db/"\* ] && return 1 - # Loop over each version file and warn if one doesn't exist. - # Also warn if a package is missing its version file. + # Loop over each package and print its name and version. for pkg; do - if [ ! -d "$pkg" ]; then + [ -d "$pkg" ] || { log "Package '$pkg' is not installed" return 1 + } - elif [ ! -f "$pkg/version" ]; then - log "[$pkg] Warning, package has no version file" - continue - fi - - read -r version release < "$pkg/version" && - printf '%s\n' "$pkg $version-$release" + read -r 2>/dev/null < "$pkg/version" || REPLY=null + printf '%s\n' "$pkg $REPLY" done }