diff options
Diffstat (limited to '.local/bin/development/gh-clone-all')
-rwxr-xr-x | .local/bin/development/gh-clone-all | 16 |
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 |