kiss: make pkg_list like other funcs

This commit is contained in:
Dylan Araps 2020-09-26 17:13:24 +03:00
parent 8dae372609
commit 8b2be5a750
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

29
kiss
View File

@ -192,22 +192,15 @@ pkg_find() {
} }
pkg_list() { pkg_list() {
[ "$1" ] || { [ -d "$sys_db/$1" ] || {
set +f log "$1" "not installed"
set -f -- "$sys_db/"*
}
for _pkg do
[ -d "$sys_db/${_pkg##*/}" ] || {
log "${_pkg##*/}" "not installed"
return 1 return 1
} }
read -r _ver 2>/dev/null < "$sys_db/${_pkg##*/}/version" || read -r _ver 2>/dev/null < "$sys_db/$1/version" ||
_ver=null _ver=null
printf '%s\n' "${_pkg##*/} $_ver" printf '%s\n' "$1 $_ver"
done
} }
pkg_cache() { pkg_cache() {
@ -1420,7 +1413,15 @@ args() {
;; ;;
l|list) l|list)
pkg_list "$@" [ "$1" ] || {
cd "$sys_db"
set +f
set -f -- *
}
for pkg do
pkg_list "$pkg"
done
;; ;;
r|remove) r|remove)
@ -1440,7 +1441,7 @@ args() {
;; ;;
v|version) v|version)
printf '5.1.0\n' printf '6.0.0\n'
;; ;;
'') '')
@ -1506,7 +1507,7 @@ main() {
# to each specific KISS instance. This allows multiple package manager # to each specific KISS instance. This allows multiple package manager
# instances to be run at once. Store the value in another variable so # instances to be run at once. Store the value in another variable so
# that it doesn't change beneath us. # that it doesn't change beneath us.
pid=${KISS_PID:-$$} pid=${KISS_PID:-"$$"}
# Catch errors and ensure that build files and directories are cleaned # Catch errors and ensure that build files and directories are cleaned
# up before we die. This occurs on 'Ctrl+C' as well as success and error. # up before we die. This occurs on 'Ctrl+C' as well as success and error.