Last active
September 7, 2023 23:14
-
-
Save RandyMcMillan/dc7da35b62ad5121b5a2b686e57beed5 to your computer and use it in GitHub Desktop.
clone gitHub organization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gnostr-org |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## clone-org.sh | |
Usage: | |
```shell | |
./clone-org.sh gnostr-org | |
``` | |
## gnostr-query | |
```shell | |
gnostr-query -i 01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe | gnostr-cat -u wss://relay.damus.io | |
``` | |
```git | |
["EVENT","gnostr-query",{"content":"diff --git a/.gitignore b/.gitignore\nnew file mode 100644\nindex 0000000..c987c6b\n--- /dev/null\n+++ b/.gitignore\n@@ -0,0 +1 @@\n+gnostr-org\ndiff --git a/clone-org.sh b/clone-org.sh\nold mode 100644\nnew mode 100755\nindex ed25076..3b521f1\n--- a/clone-org.sh\n+++ b/clone-org.sh\n@@ -9,7 +9,6 @@ export GSED\n SED=${GSED:-SED}\n export SED\n echo SED=$SED\n-exit\n result=${PWD##*/} | $SED 's/[.]+/-/g'\n export result\n org=${result/-/.}\n@@ -17,27 +16,22 @@ export org\n echo $result\n echo $org\n \n-## if [ -z \"$1\" ]; then\n-## echo \"-z $1\"\n-## ORG=gnostr-org\n-## else\n-## echo \"! -z $1\"\n-## ORG=$1\n-## fi\n-exit\n+if [ -z \"$1\" ]; then\n+ echo \"-z $1\"\n+ ORG=gnostr-org\n+else\n+ echo \"! -z $1\"\n+ ORG=$1\n+fi\n \n-gh repo list $1 --limit 1000 | while read -r repo _; do\n- gh repo clone \"$repo\" \"$repo\" -- -q 2>/dev/null || (\n- cd \"$repo\"\n- # Handle case where local checkout is on a non-main/master branch\n- # - ignore checkout errors because some repos may have zero commits,\n- # so no main or master\n- git checkout -q main 2>/dev/null || true\n- git checkout -q master 2>/dev/null || true\n- git pull -q\n- )\n-done\n-gh repo list rust-nostr --limit 1000 | while read -r repo _; do\n+\n+ORG=${1/./-}\n+echo org=$org\n+\n+## exit\n+\n+gh repo list $ORG --limit 1000 | while read -r repo _; do\n+ echo \"cloning $repo\"\n gh repo clone \"$repo\" \"$repo\" -- -q 2>/dev/null || (\n cd \"$repo\"\n # Handle case where local checkout is on a non-main/master branch\n@@ -48,14 +42,3 @@ gh repo list rust-nostr --limit 1000 | while read -r repo _; do\n git pull -q\n )\n done\n-gh repo list github --limit 1000 | while read -r repo _; do\n- gh repo clone \"$repo\" \"$repo\" -- -q 2>/dev/null || (\n- cd \"$repo\"\n- # Handle case where local checkout is on a non-main/master branch\n- # - ignore checkout errors because some repos may have zero commits,\n- # so no main or master\n- git checkout -q main 2>/dev/null || true\n- git checkout -q master 2>/dev/null || true\n- git pull -q\n- )\n-done\n\\ No newline at end of file","created_at":1694095440,"id":"01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe","kind":1,"pubkey":"d4d8d344469f0467a0b85bd78366531737a03f9de17b1131a22fbfdeed4fe2b6","sig":"83e738f62597c21ab3f747ff6e8d2fd35f6263d235ca979812334e88ab4788a7f216611a742af6c594f9dfdf08468f2ee3ee3c7c6aac59a88e8fdadc2dc0af11","tags":[["weeble","2100"],["wobble","220734"],["blockheight","806607"]]}] | |
``` | |
--- | |
``` | |
gnostr-query -i 8f1db85a5a331c3f31bdff3c09df7574a04928b90f55e70522b9d85f298d59e2 | gnostr-relays | |
``` | |
```git | |
["EVENT","gnostr-query",{"id":"8f1db85a5a331c3f31bdff3c09df7574a04928b90f55e70522b9d85f298d59e2","kind":1,"pubkey":"d4d8d344469f0467a0b85bd78366531737a03f9de17b1131a22fbfdeed4fe2b6","created_at":1694096111,"content":"diff --git a/README b/README\nnew file mode 100644\nindex 0000000..73fc9bb\n--- /dev/null\n+++ b/README\n@@ -0,0 +1,10 @@\n+## clone-org.sh\n+\n+```shell\n+gnostr-query -i 01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe | gnostr-cat -u wss://relay.damus.io\n+\n+```\n+\n+```git\n+[\"EVENT\",\"gnostr-query\",{\"content\":\"diff --git a/.gitignore b/.gitignore\\nnew file mode 100644\\nindex 0000000..c987c6b\\n--- /dev/null\\n+++ b/.gitignore\\n@@ -0,0 +1 @@\\n+gnostr-org\\ndiff --git a/clone-org.sh b/clone-org.sh\\nold mode 100644\\nnew mode 100755\\nindex ed25076..3b521f1\\n--- a/clone-org.sh\\n+++ b/clone-org.sh\\n@@ -9,7 +9,6 @@ export GSED\\n SED=${GSED:-SED}\\n export SED\\n echo SED=$SED\\n-exit\\n result=${PWD##*/} | $SED 's/[.]+/-/g'\\n export result\\n org=${result/-/.}\\n@@ -17,27 +16,22 @@ export org\\n echo $result\\n echo $org\\n \\n-## if [ -z \\\"$1\\\" ]; then\\n-## echo \\\"-z $1\\\"\\n-## ORG=gnostr-org\\n-## else\\n-## echo \\\"! -z $1\\\"\\n-## ORG=$1\\n-## fi\\n-exit\\n+if [ -z \\\"$1\\\" ]; then\\n+ echo \\\"-z $1\\\"\\n+ ORG=gnostr-org\\n+else\\n+ echo \\\"! -z $1\\\"\\n+ ORG=$1\\n+fi\\n \\n-gh repo list $1 --limit 1000 | while read -r repo _; do\\n- gh repo clone \\\"$repo\\\" \\\"$repo\\\" -- -q 2>/dev/null || (\\n- cd \\\"$repo\\\"\\n- # Handle case where local checkout is on a non-main/master branch\\n- # - ignore checkout errors because some repos may have zero commits,\\n- # so no main or master\\n- git checkout -q main 2>/dev/null || true\\n- git checkout -q master 2>/dev/null || true\\n- git pull -q\\n- )\\n-done\\n-gh repo list rust-nostr --limit 1000 | while read -r repo _; do\\n+\\n+ORG=${1/./-}\\n+echo org=$org\\n+\\n+## exit\\n+\\n+gh repo list $ORG --limit 1000 | while read -r repo _; do\\n+ echo \\\"cloning $repo\\\"\\n gh repo clone \\\"$repo\\\" \\\"$repo\\\" -- -q 2>/dev/null || (\\n cd \\\"$repo\\\"\\n # Handle case where local checkout is on a non-main/master branch\\n@@ -48,14 +42,3 @@ gh repo list rust-nostr --limit 1000 | while read -r repo _; do\\n git pull -q\\n )\\n done\\n-gh repo list github --limit 1000 | while read -r repo _; do\\n- gh repo clone \\\"$repo\\\" \\\"$repo\\\" -- -q 2>/dev/null || (\\n- cd \\\"$repo\\\"\\n- # Handle case where local checkout is on a non-main/master branch\\n- # - ignore checkout errors because some repos may have zero commits,\\n- # so no main or master\\n- git checkout -q main 2>/dev/null || true\\n- git checkout -q master 2>/dev/null || true\\n- git pull -q\\n- )\\n-done\\n\\\\ No newline at end of file\",\"created_at\":1694095440,\"id\":\"01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe\",\"kind\":1,\"pubkey\":\"d4d8d344469f0467a0b85bd78366531737a03f9de17b1131a22fbfdeed4fe2b6\",\"sig\":\"83e738f62597c21ab3f747ff6e8d2fd35f6263d235ca979812334e88ab4788a7f216611a742af6c594f9dfdf08468f2ee3ee3c7c6aac59a88e8fdadc2dc0af11\",\"tags\":[[\"weeble\",\"2100\"],[\"wobble\",\"220734\"],[\"blockheight\",\"806607\"]]}]\n+```","tags":[["weeble","2100"],["wobble","221398"],["blockheight","806607"]],"sig":"fb28d28e6a077d9a2b277ccd4033ec8a81a2e446ce2d50e8845a929332d30da20c442fd5e87aa8a18f493eca4a5962bd3eb96d840a31b498f0ffcc927c9465a9"}] | |
``` | |
```shell | |
gnostr-query -i 30ffa3bcc6143514102a9f52fe0a047f40e21bd1386e43a961ffce77ed800619 | gnostr-relays | |
``` | |
```shell | |
gnostr-query -i 30ffa3bcc6143514102a9f52fe0a047f40e21bd1386e43a961ffce77ed800619 | gnostr-cat -u wss://relay.damus.io | jq | |
``` | |
```json | |
[ | |
"EVENT", | |
"gnostr-query", | |
{ | |
"content": "diff --git a/README b/README\nindex 73fc9bb..2b377e9 100644\n--- a/README\n+++ b/README\n@@ -1,5 +1,15 @@\n ## clone-org.sh\n \n+\n+Usage:\n+\n+```shell\n+./clone-org.sh gnostr-org\n+```\n+\n+## gnostr-query\n+\n+\n ```shell\n gnostr-query -i 01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe | gnostr-cat -u wss://relay.damus.io\n \n@@ -8,3 +18,16 @@ gnostr-query -i 01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe\n ```git\n [\"EVENT\",\"gnostr-query\",{\"content\":\"diff --git a/.gitignore b/.gitignore\\nnew file mode 100644\\nindex 0000000..c987c6b\\n--- /dev/null\\n+++ b/.gitignore\\n@@ -0,0 +1 @@\\n+gnostr-org\\ndiff --git a/clone-org.sh b/clone-org.sh\\nold mode 100644\\nnew mode 100755\\nindex ed25076..3b521f1\\n--- a/clone-org.sh\\n+++ b/clone-org.sh\\n@@ -9,7 +9,6 @@ export GSED\\n SED=${GSED:-SED}\\n export SED\\n echo SED=$SED\\n-exit\\n result=${PWD##*/} | $SED 's/[.]+/-/g'\\n export result\\n org=${result/-/.}\\n@@ -17,27 +16,22 @@ export org\\n echo $result\\n echo $org\\n \\n-## if [ -z \\\"$1\\\" ]; then\\n-## echo \\\"-z $1\\\"\\n-## ORG=gnostr-org\\n-## else\\n-## echo \\\"! -z $1\\\"\\n-## ORG=$1\\n-## fi\\n-exit\\n+if [ -z \\\"$1\\\" ]; then\\n+ echo \\\"-z $1\\\"\\n+ ORG=gnostr-org\\n+else\\n+ echo \\\"! -z $1\\\"\\n+ ORG=$1\\n+fi\\n \\n-gh repo list $1 --limit 1000 | while read -r repo _; do\\n- gh repo clone \\\"$repo\\\" \\\"$repo\\\" -- -q 2>/dev/null || (\\n- cd \\\"$repo\\\"\\n- # Handle case where local checkout is on a non-main/master branch\\n- # - ignore checkout errors because some repos may have zero commits,\\n- # so no main or master\\n- git checkout -q main 2>/dev/null || true\\n- git checkout -q master 2>/dev/null || true\\n- git pull -q\\n- )\\n-done\\n-gh repo list rust-nostr --limit 1000 | while read -r repo _; do\\n+\\n+ORG=${1/./-}\\n+echo org=$org\\n+\\n+## exit\\n+\\n+gh repo list $ORG --limit 1000 | while read -r repo _; do\\n+ echo \\\"cloning $repo\\\"\\n gh repo clone \\\"$repo\\\" \\\"$repo\\\" -- -q 2>/dev/null || (\\n cd \\\"$repo\\\"\\n # Handle case where local checkout is on a non-main/master branch\\n@@ -48,14 +42,3 @@ gh repo list rust-nostr --limit 1000 | while read -r repo _; do\\n git pull -q\\n )\\n done\\n-gh repo list github --limit 1000 | while read -r repo _; do\\n- gh repo clone \\\"$repo\\\" \\\"$repo\\\" -- -q 2>/dev/null || (\\n- cd \\\"$repo\\\"\\n- # Handle case where local checkout is on a non-main/master branch\\n- # - ignore checkout errors because some repos may have zero commits,\\n- # so no main or master\\n- git checkout -q main 2>/dev/null || true\\n- git checkout -q master 2>/dev/null || true\\n- git pull -q\\n- )\\n-done\\n\\\\ No newline at end of file\",\"created_at\":1694095440,\"id\":\"01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe\",\"kind\":1,\"pubkey\":\"d4d8d344469f0467a0b85bd78366531737a03f9de17b1131a22fbfdeed4fe2b6\",\"sig\":\"83e738f62597c21ab3f747ff6e8d2fd35f6263d235ca979812334e88ab4788a7f216611a742af6c594f9dfdf08468f2ee3ee3c7c6aac59a88e8fdadc2dc0af11\",\"tags\":[[\"weeble\",\"2100\"],[\"wobble\",\"220734\"],[\"blockheight\",\"806607\"]]}]\n ```\n+\n+\n+---\n+\n+\n+```\n+gnostr-query -i 8f1db85a5a331c3f31bdff3c09df7574a04928b90f55e70522b9d85f298d59e2 | gnostr-relays \n+```\n+\n+```git\n+[\"EVENT\",\"gnostr-query\",{\"id\":\"8f1db85a5a331c3f31bdff3c09df7574a04928b90f55e70522b9d85f298d59e2\",\"kind\":1,\"pubkey\":\"d4d8d344469f0467a0b85bd78366531737a03f9de17b1131a22fbfdeed4fe2b6\",\"created_at\":1694096111,\"content\":\"diff --git a/README b/README\\nnew file mode 100644\\nindex 0000000..73fc9bb\\n--- /dev/null\\n+++ b/README\\n@@ -0,0 +1,10 @@\\n+## clone-org.sh\\n+\\n+```shell\\n+gnostr-query -i 01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe | gnostr-cat -u wss://relay.damus.io\\n+\\n+```\\n+\\n+```git\\n+[\\\"EVENT\\\",\\\"gnostr-query\\\",{\\\"content\\\":\\\"diff --git a/.gitignore b/.gitignore\\\\nnew file mode 100644\\\\nindex 0000000..c987c6b\\\\n--- /dev/null\\\\n+++ b/.gitignore\\\\n@@ -0,0 +1 @@\\\\n+gnostr-org\\\\ndiff --git a/clone-org.sh b/clone-org.sh\\\\nold mode 100644\\\\nnew mode 100755\\\\nindex ed25076..3b521f1\\\\n--- a/clone-org.sh\\\\n+++ b/clone-org.sh\\\\n@@ -9,7 +9,6 @@ export GSED\\\\n SED=${GSED:-SED}\\\\n export SED\\\\n echo SED=$SED\\\\n-exit\\\\n result=${PWD##*/} | $SED 's/[.]+/-/g'\\\\n export result\\\\n org=${result/-/.}\\\\n@@ -17,27 +16,22 @@ export org\\\\n echo $result\\\\n echo $org\\\\n \\\\n-## if [ -z \\\\\\\"$1\\\\\\\" ]; then\\\\n-## echo \\\\\\\"-z $1\\\\\\\"\\\\n-## ORG=gnostr-org\\\\n-## else\\\\n-## echo \\\\\\\"! -z $1\\\\\\\"\\\\n-## ORG=$1\\\\n-## fi\\\\n-exit\\\\n+if [ -z \\\\\\\"$1\\\\\\\" ]; then\\\\n+ echo \\\\\\\"-z $1\\\\\\\"\\\\n+ ORG=gnostr-org\\\\n+else\\\\n+ echo \\\\\\\"! -z $1\\\\\\\"\\\\n+ ORG=$1\\\\n+fi\\\\n \\\\n-gh repo list $1 --limit 1000 | while read -r repo _; do\\\\n- gh repo clone \\\\\\\"$repo\\\\\\\" \\\\\\\"$repo\\\\\\\" -- -q 2>/dev/null || (\\\\n- cd \\\\\\\"$repo\\\\\\\"\\\\n- # Handle case where local checkout is on a non-main/master branch\\\\n- # - ignore checkout errors because some repos may have zero commits,\\\\n- # so no main or master\\\\n- git checkout -q main 2>/dev/null || true\\\\n- git checkout -q master 2>/dev/null || true\\\\n- git pull -q\\\\n- )\\\\n-done\\\\n-gh repo list rust-nostr --limit 1000 | while read -r repo _; do\\\\n+\\\\n+ORG=${1/./-}\\\\n+echo org=$org\\\\n+\\\\n+## exit\\\\n+\\\\n+gh repo list $ORG --limit 1000 | while read -r repo _; do\\\\n+ echo \\\\\\\"cloning $repo\\\\\\\"\\\\n gh repo clone \\\\\\\"$repo\\\\\\\" \\\\\\\"$repo\\\\\\\" -- -q 2>/dev/null || (\\\\n cd \\\\\\\"$repo\\\\\\\"\\\\n # Handle case where local checkout is on a non-main/master branch\\\\n@@ -48,14 +42,3 @@ gh repo list rust-nostr --limit 1000 | while read -r repo _; do\\\\n git pull -q\\\\n )\\\\n done\\\\n-gh repo list github --limit 1000 | while read -r repo _; do\\\\n- gh repo clone \\\\\\\"$repo\\\\\\\" \\\\\\\"$repo\\\\\\\" -- -q 2>/dev/null || (\\\\n- cd \\\\\\\"$repo\\\\\\\"\\\\n- # Handle case where local checkout is on a non-main/master branch\\\\n- # - ignore checkout errors because some repos may have zero commits,\\\\n- # so no main or master\\\\n- git checkout -q main 2>/dev/null || true\\\\n- git checkout -q master 2>/dev/null || true\\\\n- git pull -q\\\\n- )\\\\n-done\\\\n\\\\\\\\ No newline at end of file\\\",\\\"created_at\\\":1694095440,\\\"id\\\":\\\"01d4c53f86cf057fd9ac8d5c01a645004f7e83b2318618d94e7de642c601b4fe\\\",\\\"kind\\\":1,\\\"pubkey\\\":\\\"d4d8d344469f0467a0b85bd78366531737a03f9de17b1131a22fbfdeed4fe2b6\\\",\\\"sig\\\":\\\"83e738f62597c21ab3f747ff6e8d2fd35f6263d235ca979812334e88ab4788a7f216611a742af6c594f9dfdf08468f2ee3ee3c7c6aac59a88e8fdadc2dc0af11\\\",\\\"tags\\\":[[\\\"weeble\\\",\\\"2100\\\"],[\\\"wobble\\\",\\\"220734\\\"],[\\\"blockheight\\\",\\\"806607\\\"]]}]\\n+```\",\"tags\":[[\"weeble\",\"2100\"],[\"wobble\",\"221398\"],[\"blockheight\",\"806607\"]],\"sig\":\"fb28d28e6a077d9a2b277ccd4033ec8a81a2e446ce2d50e8845a929332d30da20c442fd5e87aa8a18f493eca4a5962bd3eb96d840a31b498f0ffcc927c9465a9\"}]\n+\n+```", | |
"created_at": 1694096578, | |
"id": "30ffa3bcc6143514102a9f52fe0a047f40e21bd1386e43a961ffce77ed800619", | |
"kind": 1, | |
"pubkey": "d4d8d344469f0467a0b85bd78366531737a03f9de17b1131a22fbfdeed4fe2b6", | |
"sig": "ca67c79f97ebcbeea36fbf4997686ae69c40e99b0d440db7a15585c6ed86fa47c5cac902b77dec2b82467c252549080819d0b563c3df0144cf9ce6c41bb55a57", | |
"tags": [ | |
[ | |
"weeble", | |
"2100" | |
], | |
[ | |
"wobble", | |
"217672" | |
], | |
[ | |
"blockheight", | |
"806609" | |
] | |
] | |
} | |
] | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SED=$(which sed) | |
## echo $SED | |
export SED | |
GSED=$(which gsed) | |
## echo $GSED | |
export GSED | |
SED=${GSED:-SED} | |
export SED | |
## echo SED=$SED | |
result=${PWD##*/} | $SED 's/[.]+/-/g' | |
export result | |
org=${result/-/.} | |
export org | |
## echo $result | |
## echo $org | |
if [ -z "$1" ]; then | |
## echo "-z $1" | |
ORG=gnostr-org | |
else | |
## echo "! -z $1" | |
ORG=$1 | |
fi | |
ORG=${1/./-} | |
# echo org=$org | |
## exit | |
gh repo list $ORG --limit 1000 | while read -r repo _; do | |
echo "cloning $repo" | |
gh repo clone "$repo" "$repo" -- -q 2>/dev/null || ( | |
cd "$repo" | |
# Handle case where local checkout is on a non-main/master branch | |
# - ignore checkout errors because some repos may have zero commits, | |
# so no main or master | |
git checkout -q main 2>/dev/null || true | |
git checkout -q master 2>/dev/null || true | |
git pull -q | |
) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment