summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeppia <seppia@seppia.net>2018-05-31 12:57:25 +0200
committerSeppia <seppia@seppia.net>2018-05-31 12:57:25 +0200
commit6857bf318707207bdbb789de926bd77a70747f89 (patch)
treef6ffe4962a0e2fe9a296d18616846ab6c3d6af28
parentae8a54f4652e4385be11a72838e4c0420104f27e (diff)
downloadrepofish-6857bf318707207bdbb789de926bd77a70747f89.tar.gz
repofish-6857bf318707207bdbb789de926bd77a70747f89.tar.bz2
repofish-6857bf318707207bdbb789de926bd77a70747f89.zip
Add function modifications
'Add' (url) function renamed to 'clone' and added new 'add' function which uses packages names
-rwxr-xr-xrepo.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/repo.sh b/repo.sh
index c22ff31..7767b0c 100755
--- a/repo.sh
+++ b/repo.sh
@@ -8,8 +8,18 @@
## Search variables
URL_PREFIX='https://aur.archlinux.org/rpc/?v=5&type=search&by=name-desc&arg='
+CLONE_PREFIX='https://aur.archlinux.org/'
add_package() {
+ if [ ! -d "${SRC_PATH}/$1" ]; then
+ cd ${SRC_PATH}
+ git clone ${CLONE_PREFIX}$1.git
+ else
+ echo 'Package already present.'
+ fi
+}
+
+clone_package() {
if [ ! -d "${SRC_PATH}/$(echo $1 | awk -F '/' '{print $NF}' | cut -d '.' -f 1)" ]; then
cd ${SRC_PATH}
git clone $1
@@ -109,7 +119,8 @@ print_help() {
echo
echo ' USAGE: repo.sh COMMAND PKGNAME (default ALL)'
echo
- echo ' add (url) adds git package repository from aur'
+ echo ' add adds package from from AUR'
+ echo ' clone (url) clones git package repository'
echo ' rm remove package'
echo ' check check PKGBUILD'
echo ' list lists availables packages'
@@ -137,6 +148,14 @@ elif [ "$1" == 'add' ]; then
else
add_package $2
fi
+elif [ "$1" == 'clone' ]; then
+ if [ "$3" != '' ]; then
+ echo 'error: too many arguments.'
+ elif [ "$2" == '' ]; then
+ echo 'error: missing argument.'
+ else
+ clone_package $2
+ fi
elif [ "$1" == 'rm' ]; then
if [ "$3" != '' ]; then
echo 'error: too many arguments.'