diff --git a/kiss b/kiss index a800e1e..771c75a 100755 --- a/kiss +++ b/kiss @@ -119,7 +119,7 @@ pkg_find() { # in $KISS_PATH/*. query=$1 match=$2 IFS=:; set -- - # Both counts of word-splitting is intentional here. + # Both counts of word-splitting are intentional here. # Firstly to split the repositories and secondly to # allow for the query to be a glob. # shellcheck disable=2086 @@ -131,6 +131,8 @@ pkg_find() { done done + IFS=$old_ifs + # A package may also not be found due to a repository not being # readable by the current user. Either way, we need to die here. [ "$1" ] || die "Package '$query' not in any repository" @@ -138,8 +140,6 @@ pkg_find() { # Show all search results if called from 'kiss search', else # print only the first match. [ "$match" ] && printf '%s\n' "$@" || printf '%s\n' "$1" - - IFS=$old_ifs } pkg_list() { @@ -148,21 +148,13 @@ pkg_list() { # file read. # Change directories to the database. This allows us to - # avoid having to 'basename' each path. If this fails, - # set '$1' to mimic a failed glob which indicates that - # nothing is installed. - cd "$sys_db" 2>/dev/null || set -- "$sys_db/"\* + # avoid having to 'basename' each path. . + cd "$sys_db" 2>/dev/null # Optional arguments can be passed to check for specific - # packages. If no arguments are passed, list all. As we - # loop over '$@', if there aren't any arguments we can - # just set the directory contents to the argument list. + # packages. If no arguments are passed, list all. [ "$1" ] || { set +f; set -f -- *; } - # If the 'glob' above failed, exit early as there are no - # packages installed. - [ "$1" = "$sys_db/"\* ] && return 1 - # Loop over each package and print its name and version. for pkg do [ -d "$pkg" ] || { log "$pkg" "not installed"; return 1; }