diff options
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -131,18 +131,23 @@ pkg_lint() { } pkg_find() { + # Use a SEARCH_PATH variable so that we can get the sys_db into + # the same variable as KISS_PATH. This makes it easier when we are + # searching for executables instead of KISS_PATH. + : "${SEARCH_PATH:=$KISS_PATH:$sys_db}" + # Figure out which repository a package belongs to by # searching for directories matching the package name # in $KISS_PATH/*. - query=$1 match=$2 IFS=:; set -- + query=$1 match=$2 type=$3 IFS=:; set -- # Word splitting is intentional here. # shellcheck disable=2086 - for path in $KISS_PATH "$sys_db" ; do + for path in $SEARCH_PATH ; do set +f for path2 in "$path/"$query; do - [ -x "$path2" ] && set -f -- "$@" "$path2" + test "${type:--d}" "$path2" && set -f -- "$@" "$path2" done done @@ -1455,7 +1460,7 @@ args() { log "Installed extensions" set -- - for path in $(KISS_PATH=$PATH pkg_find kiss-* all); do + for path in $(SEARCH_PATH=$PATH pkg_find kiss-* all -x); do set -- "${path#*/kiss-}" "$@" max=$((${#1} > max ? ${#1} : max)) done @@ -1513,7 +1518,7 @@ args() { ;; *) - util=$(KISS_PATH=$PATH pkg_find "kiss-$action"* 2>/dev/null) || + util=$(SEARCH_PATH=$PATH pkg_find "kiss-$action"* "" -x 2>/dev/null) || die "'kiss $action' is not a valid command" "$util" "$@" |