Last active
October 6, 2017 20:27
-
-
Save 32teeth/81785bd4f3d4563224e80cb9de31d48f to your computer and use it in GitHub Desktop.
Create a GitHub repo from command line
This file contains 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
#!/bin/zsh | |
export NC='\e[0m' # No Color | |
export WHITE='\e[1;37m' | |
export BLUE='\e[1;34m' | |
export GREEN='\e[0;32m' | |
export YELLOW='\e[1;33m' | |
export TODAY=`date +%A\ %B\ %Y\ %T` | |
export NOTIFIER=0 | |
export PLAIN=๐บ | |
export HAPPY=๐ธ | |
export WINK=๐ผ | |
export LOVE=๐ป | |
export SAD=๐ฟ | |
export EVIL=๐ผ | |
export ANGRY=๐พ | |
export WAIT=๐ฝ | |
clear | |
export JQ=0; | |
if (brew list | grep -q 'jq') | |
then | |
JQ=1 | |
echo " ${LOVE} required packages installed!" | |
fi | |
if [ "$JQ" = "0" ] | |
then | |
echo " ${SAD} ${RED}required packages NOT installed!${NC}" | |
echo " ${EVIL} installing required packages" | |
brew install jq | |
fi | |
clear | |
title="So you want to create a github repository" | |
export private=false | |
export auto_init=false | |
echo "\n--------------------------------------------------------------------------" | |
echo "\n${GREEN}${WINK} ${title}:${NC}" | |
echo "\n--------------------------------------------------------------------------" | |
echo -n "${WHITE}Username? ${NC}" | |
read user | |
echo -n "${WHITE}Repository name? ${NC}" | |
read name | |
echo -n "${WHITE}Repository description? ${NC}" | |
read description | |
echo "${WHITE}Is this a private repo?${NC}" | |
select PRIVATE in "Yes" "No"; do | |
case $PRIVATE in | |
Yes ) break;; | |
No ) break;; | |
* ) echo "not found";; | |
esac | |
done | |
if [ "$PRIVATE" = "Yes" ] | |
then | |
private=true | |
fi | |
echo "${WHITE}Do you want to create a README.md?${NC}" | |
select README in "Yes" "No"; do | |
case $README in | |
Yes ) break;; | |
No ) break;; | |
* ) echo "not found";; | |
esac | |
done | |
if [ "$README" = "Yes" ] | |
then | |
auto_init=true | |
fi | |
json="{\"name\":\"${name}\",\"description\":\"${description}\",\"private\":${private},\"auto_init\":${auto_init}}" | |
curl -u ${user} https://api.github.com/user/repos -d ${json} | jq '. | {name: .name, ssh: .ssh_url, html: .html_url}' | |
#curl -u ${user} https://api.github.com/user/repos -d $json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment