summaryrefslogtreecommitdiff
path: root/.local/bin/development/gh-clone-all
diff options
context:
space:
mode:
authorVikas Kushwaha <dev@vikas.rocks>2025-04-29 09:25:30 +0530
committerVikas Kushwaha <dev@vikas.rocks>2025-04-29 09:28:54 +0530
commit7df7120b1ae66ed0e9a7c6ed9b224ba44ea1d920 (patch)
tree1a9f78045786dbbad346204d3957194af04988e4 /.local/bin/development/gh-clone-all
parenta2860b969e97e47a2b1c0ddb7161adb5b35c06f3 (diff)
Updates
Diffstat (limited to '.local/bin/development/gh-clone-all')
-rwxr-xr-x.local/bin/development/gh-clone-all16
1 files changed, 16 insertions, 0 deletions
diff --git a/.local/bin/development/gh-clone-all b/.local/bin/development/gh-clone-all
new file mode 100755
index 0000000..d2b3cdc
--- /dev/null
+++ b/.local/bin/development/gh-clone-all
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+cntx="${1%%/*}"
+name="${1##*/}"
+max="${2:-${MAX:-1}}"
+[ "$cntx" = "$name" ] && cntx=users
+[ -z "$cntx" ] && cntx=users
+[ -z "$name" ] && name=${PWD##*/}
+
+page=0
+while [ "$page" -lt "$max" ]; do
+ page=$(( page + 1 ))
+ curl "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100" |
+ sed -E '/^\s*"clone_url": "(.*)",$/!d; s//\1/' |
+ xargs -L1 echo git clone
+done