add fuction

add repository search option
This commit is contained in:
Kaisa Marysia 2025-08-01 10:06:44 +02:00
parent 6f77f53988
commit 2de1d481f4

View file

@ -28,6 +28,7 @@ Options:
-i PACKAGENAME install package
-l list installed packages
-r PACKAGENAME remove packagename
-s PACKAGENAME search the archlinux repositories for given package
-u update all installed packages
EOF
@ -51,6 +52,10 @@ while [ "$1" ]; do
shift
source="list"
;;
-s)
shift
source="search"
;;
-h)
usage
exit 0
@ -83,6 +88,10 @@ function list() {
ls ~/.local/var/pkglist/*.lst | awk -F "/" '{print $NF}' | sed 's/\.lst//g'
}
function search() {
pacman -Ss $1
}
if [[ "$source" == "install" ]]; then
if [ -z "$PACKAGE" ]; then
echo "see -h for usage"
@ -100,6 +109,12 @@ elif [[ "$source" == "list" ]]; then
exit 1
fi
list
elif [[ "$source" == "search" ]]; then
if [ -z "$PACKAGE" ]; then
echo "see -h for usage"
exit 1
fi
search $PACKAGE
elif [[ "$source" == "update" ]]; then
update
elif [[ -z "$source" ]]; then