mirror of
https://github.com/RGBCube/random-scripts
synced 2025-05-15 03:24:57 +00:00
Add clone all script
This commit is contained in:
parent
8a73e9c800
commit
4f14279e6c
1 changed files with 25 additions and 0 deletions
25
git-clone-all.nu
Executable file
25
git-clone-all.nu
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
|
||||||
|
def main [
|
||||||
|
--org (-o): string = ""
|
||||||
|
--user (-u): string = ""
|
||||||
|
] {
|
||||||
|
let path = if not ($org | is-empty) {
|
||||||
|
"orgs/" + $org
|
||||||
|
} else if not ($user | is-empty) {
|
||||||
|
"users/" + $user
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($path | is-empty) {
|
||||||
|
echo $"(ansi red)error:(ansi reset) either org or user must be supplied"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Couldn't get parallel to work correctly so whatever.
|
||||||
|
http get https://api.github.com/($path)/repos
|
||||||
|
| each { git clone $"https://github.com/($in.full_name)" }
|
||||||
|
|
||||||
|
print "\nDone!"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue