Created
December 3, 2021 14:19
-
-
Save barhoring/cfdce6c3d25addcacbd7ccf8f446a04b to your computer and use it in GitHub Desktop.
codepen to git
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
# run like: | |
# LINK=https://codepen-api-export-production.s3.us-west-2.amazonaws.com/zip/PEN/*********/*****************/2a-end-flexbox-grid-system.zip | |
# sh gitpen.sh $LINK | |
# example | |
# sh gitpen.sh https://codepen-api-export-production.s3.us-west-2.amazonaws.com/zip/PEN/*********/*****************/2a-end-flexbox-grid-system.zip | |
# | |
MYVAR=$1 | |
NAME="${MYVAR#http://}" | |
NAME=${NAME##*/} | |
printf "fetching $NAME...\n" | |
curl $1 -O -J -L -s | |
printf "unzipping $NAME...\n" | |
unzip -qq $NAME | |
# delete the downloaded .zip file | |
rm -rf $NAME | |
NAME=${NAME%.*} | |
cd $NAME | |
git init > /dev/null | |
COMMIT_NAME="${NAME} - initial commit" | |
git add --all | |
git commit -m "$COMMIT_NAME" --quiet | |
printf "created $NAME\n" | |
printf "run: \n cd $NAME\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment