diff options
-rwxr-xr-x | repo.sh | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -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 |