Last active
October 12, 2022 11:06
-
-
Save jhadev/03f59fdcc9424d03bf0be0ed8f25b224 to your computer and use it in GitHub Desktop.
create_html_repo.zsh
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
source ${ZDOTDIR-$HOME}/.zsh/create_html_repo.zsh | |
export GH_TOKEN=<TOKEN> | |
export REPO_NAME="$USER-automated-repo" | |
# create_html_repo my-cool-project | |
create_html_repo() { | |
cd ~/Desktop && mkdir $1 && cd $1 && touch index.html && mkdir assets && mkdir assets/js && mkdir assets/css && touch assets/js/script.js && touch assets/css/style.css && echo '<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<link rel="stylesheet" href="./assets/css/style.css"> | |
</head> | |
<body> | |
<h1>Hi!</h1> | |
<script src="./assets/js/script.js"></script> | |
</body> | |
</html>' > index.html | |
# ls -la | |
echo default $1 | |
# vared -c -p 'Please enter a repo name: ' REPO_NAME | |
# echo new $REPO_NAME | |
REPO_NAME=$1 | |
curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GH_TOKEN" \ | |
https://api.github.com/user/repos \ | |
-d'{"name":"'"$REPO_NAME"'"}' | |
set $REPO_NAME="" | |
echo DONE! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
move this file to ~/.zsh
source ${ZDOTDIR-$HOME}/.zsh/create_repo.zsh in .zshrc
Create a Personal Access Token in https://github.com/settings/tokens