pkg_find: use case

This commit is contained in:
Dylan Araps 2021-07-14 10:04:18 +03:00
parent dc776868d2
commit 759e4fb868
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 17 additions and 6 deletions

23
kiss
View File

@ -210,13 +210,24 @@ pkg_find() {
unset 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.
[ "$5" ] || return 1
# Show all search results if called from 'kiss search', else store the
# value in a variable.
[ "$2" ] && { shift 4; printf '%s\n' "$@"; } || repo_dir=$5
# values in variables.
case $2-$# in
*-4)
# 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.
return 1
;;
-*)
repo_dir=$5
;;
*)
shift 4
printf '%s\n' "$@";
;;
esac
}
pkg_list() {