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