summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkj-sh604 <43.splash@gmail.com>2025-06-10 13:22:32 -0400
committerkj-sh604 <43.splash@gmail.com>2025-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 @@
-gitpkg
+gitpkg/gitaur
------
-simple POSIX helper script that grabs the PKGBUILD of Arch Linux packages (in
-the official repos) via `git`.
+simple POSIX helper scripts that grabs the PKGBUILD of Arch Linux packages via
+`git`.
+
+gitpkg = grabs PKGBUILDs from the Official Arch Repositories
+gitaur = grabs PKGBUILDs from the Arch User Repository
------
usage:
- gitpkg [-h|--help]
- gitpkg <package name> <package name>...
+ $0 [-h|--help]
+ $0 <package name> <package name>...
options:
-h, --help
diff --git a/gitaur b/gitaur
new file mode 100755
index 0000000..9c8bffe
--- /dev/null
+++ b/gitaur
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+check_git_installed() {
+ if ! command -v git >/dev/null 2>&1; then
+ echo "error: git is not installed :( please git wget to use $0."
+ exit 1
+ fi
+}
+
+_base_url='https://aur.archlinux.org'
+
+get_url_function() {
+ _pkg="$1"
+ _url="${_base_url}/${_pkg}.git"
+
+ echo "$_url"
+}
+
+run_grabber_function() {
+ _pkg="$(echo "$1" | tr -d '[:space:]')"
+ _url="$(get_url_function "$_pkg")"
+
+ git clone "$_url"
+}
+
+grabber_function() {
+ for _pkg in "$@"; do
+ run_grabber_function "$_pkg" &
+ done
+ wait
+}
+
+usage_function() {
+ cat <<EOF
+usage:
+ $0 [-h|--help]
+ $0 <pkg> <pkg>...
+
+options:
+ -h, --help
+ print this help message
+EOF
+}
+
+check_git_installed
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -*)
+ usage_function
+ exit 0
+ ;;
+ *)
+ grabber_function "$@"
+ exit 0
+ ;;
+ esac
+done
+
+# vim: set filetype=sh foldmethod=marker foldlevel=0: