forked from kiss-community/kiss
pkg_list: remove cd usage
This commit is contained in:
parent
000e8e36d3
commit
4396d34fcc
11
kiss
11
kiss
@ -186,24 +186,23 @@ pkg_find() {
|
|||||||
pkg_list() {
|
pkg_list() {
|
||||||
# List installed packages. As the format is files and directories, this
|
# List installed packages. As the format is files and directories, this
|
||||||
# just involves a simple for loop and file read.
|
# just involves a simple for loop and file read.
|
||||||
cd "$sys_db"
|
|
||||||
|
|
||||||
# Optional arguments can be passed to check for specific packages. If no
|
# Optional arguments can be passed to check for specific packages. If no
|
||||||
# arguments are passed, list all.
|
# arguments are passed, list all.
|
||||||
[ "$1" ] || { set +f; set -f -- *; }
|
[ "$1" ] || { set +f; set -f -- "$sys_db"/*; }
|
||||||
|
|
||||||
# Loop over each package and print its name and version.
|
# Loop over each package and print its name and version.
|
||||||
for _list_pkg do
|
for _list_pkg do
|
||||||
|
_list_pkg=$sys_db/${_list_pkg##*/}
|
||||||
|
|
||||||
[ -d "$_list_pkg" ] || {
|
[ -d "$_list_pkg" ] || {
|
||||||
log "$_list_pkg" "not installed"
|
log "${_list_pkg##*/}" "not installed"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
read -r version 2>/dev/null < "$_list_pkg/version" || version=null
|
read -r version 2>/dev/null < "$_list_pkg/version" || version=null
|
||||||
printf '%s\n' "$_list_pkg $version"
|
printf '%s\n' "${_list_pkg##*/} $version"
|
||||||
done
|
done
|
||||||
|
|
||||||
cd "$OLDPWD"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_cache() {
|
pkg_cache() {
|
||||||
|
Loading…
Reference in New Issue
Block a user