summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrepo.sh26
1 files changed, 16 insertions, 10 deletions
diff --git a/repo.sh b/repo.sh
index b2900e7..4f9c346 100755
--- a/repo.sh
+++ b/repo.sh
@@ -11,12 +11,15 @@ URL_PREFIX='https://aur.archlinux.org/'
SEARCH_STR='rpc/?v=5&type=search&by=name-desc&arg='
add_package() {
- if [ ! -d "${SRC_PATH}/$1" ]; then
- cd ${SRC_PATH}
- git clone ${URL_PREFIX}$1.git
- else
- echo 'WARNING: Package already present.'
- fi
+ declare -a pkg=("${!1}")
+ for i in "${pkg[@]}"; do
+ if [ ! -d "${SRC_PATH}/$i" ]; then
+ cd ${SRC_PATH}
+ git clone ${URL_PREFIX}$i.git
+ else
+ echo 'WARNING: Package '"$i"' already present.'
+ fi
+ done
}
clone_package() {
@@ -168,12 +171,15 @@ elif [ ! -d "${SRC_PATH}" ]; then
elif [ "$1" == '' ]; then
echo 'WARNING: no command called.'
elif [ "$1" == 'add' ]; then
- if [ "$3" != '' ]; then
- echo 'ERROR: too many arguments.'
- elif [ "$2" == '' ]; then
+ if [ "$2" == '' ]; then
echo 'ERROR: missing argument.'
else
- add_package $2
+ N=2
+ while [ "${!N}" != '' ]; do
+ packages[$((N-2))]=${!N}
+ let N=N+1
+ done
+ add_package packages[@]
fi
elif [ "$1" == 'clone' ]; then
if [ "$3" != '' ]; then