Skip to content

Instantly share code, notes, and snippets.

@romicofre
Created April 28, 2024 02:48
Show Gist options
  • Save romicofre/bf18509f6d1e182128db68a8e4488397 to your computer and use it in GitHub Desktop.
Save romicofre/bf18509f6d1e182128db68a8e4488397 to your computer and use it in GitHub Desktop.
Admin Gists
#!/bin/bash
# clone all gists of the accou
# with url id
#for name in $( gh gist list | awk '{print $2}'); do gh gist clone $name; done;
# with description folder
#gh api \
# -H "Accept: application/vnd.github+json" \
# /gists | json -a description | sed -e 's/ /-/g'
#LIST=$(gh api \
# -H "Accept: application/vnd.github+json" \
# /gists | json -a -d+ description id | sed -e 's/ /-/g' | sed -e 's/+/ /g'
#)
#
#echo $LIST
for description in $(gh api -H "Accept: application/vnd.github+json" /gists | \
json -a -d~ description id | sed -e 's/ /-/g'); \
do
DESC=$(echo $description | cut -f1 -d~ | sed 's/[^a-zA-Z0-9]//g')
echo $DESC
ID=$(echo $description | cut -f2 -d~)
mkdir $DESC; cd $DESC;
echo "Cloning: " $ID
gh gist clone $ID;
cd ..
done;
# mkdir $description; \
# cd $description; \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment