summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkj-sh6042025-06-10 13:22:32 -0400
committerkj-sh6042025-06-10 13:22:32 -0400
commit99d22e189963e836d9655862427f4c8d18ba1421 (patch)
tree50df3d6de0929cfcd2dec63e6b9251537692f27e
parentbb03272d630e53fbe736c0d9a29498f110051d23 (diff)
feat: add `gitaur`HEADmaster
-rw-r--r--README13
-rwxr-xr-xgitaur60
2 files changed, 68 insertions, 5 deletions
diff --git a/README b/README
index 63773e4..a76e59e 100644
--- a/README
+++ b/README
@@ -1,14 +1,17 @@
1gitpkg 1gitpkg/gitaur
2------ 2------
3 3
4simple POSIX helper script that grabs the PKGBUILD of Arch Linux packages (in 4simple POSIX helper scripts that grabs the PKGBUILD of Arch Linux packages via
5the official repos) via `git`. 5`git`.
6
7gitpkg = grabs PKGBUILDs from the Official Arch Repositories
8gitaur = grabs PKGBUILDs from the Arch User Repository
6 9
7------ 10------
8 11
9usage: 12usage:
10 gitpkg [-h|--help] 13 $0 [-h|--help]
11 gitpkg <package name> <package name>... 14 $0 <package name> <package name>...
12 15
13options: 16options:
14 -h, --help 17 -h, --help
diff --git a/gitaur b/gitaur
new file mode 100755
index 0000000..9c8bffe
--- /dev/null
+++ b/gitaur
@@ -0,0 +1,60 @@
1#!/bin/sh
2
3check_git_installed() {
4 if ! command -v git >/dev/null 2>&1; then
5 echo "error: git is not installed :( please git wget to use $0."
6 exit 1
7 fi
8}
9
10_base_url='https://aur.archlinux.org'
11
12get_url_function() {
13 _pkg="$1"
14 _url="${_base_url}/${_pkg}.git"
15
16 echo "$_url"
17}
18
19run_grabber_function() {
20 _pkg="$(echo "$1" | tr -d '[:space:]')"
21 _url="$(get_url_function "$_pkg")"
22
23 git clone "$_url"
24}
25
26grabber_function() {
27 for _pkg in "$@"; do
28 run_grabber_function "$_pkg" &
29 done
30 wait
31}
32
33usage_function() {
34 cat <<EOF
35usage:
36 $0 [-h|--help]
37 $0 <pkg> <pkg>...
38
39options:
40 -h, --help
41 print this help message
42EOF
43}
44
45check_git_installed
46
47while [ $# -gt 0 ]; do
48 case "$1" in
49 -*)
50 usage_function
51 exit 0
52 ;;
53 *)
54 grabber_function "$@"
55 exit 0
56 ;;
57 esac
58done
59
60# vim: set filetype=sh foldmethod=marker foldlevel=0: