gitea.sh/gitea.sh

36 lines
880 B
Bash
Executable File

newrepo(){
if [ $2 == "help" ]; then
echo "Usage:"
# 1 2 3 4 5 6 7 8 9 10
echo " gitea.sh newrepo <n> <d> <p> <l> <ai> <il> <rm> <i> <t>"
echo "n: Repo's name"
echo "d: Repo's description"
echo "p: private"
echo "l: Licence"
echo "ai: auto init"
echo "il: issue labels"
echo "rm: readme"
echo "i: Files to ignores"
echo "t: token"
else
url="https://tildegit.org/api/v1/user/repos?token=${10}"
data="{\
\"name\": \"$2\",\
\"description\": \"$3\",\
\"private\": $4,\
\"license\": \"$5\",\
\"auto_init\":$6,\
\"issue_labels\": \"$7\",\
\"readme\": \"$8\",\
\"gitignores\": \"$9\"}"
curl -X POST "$url" -H "accept: application/json" \
-H "Content-Type: application/json" \
-d "$data"
fi
}
if [ $1 == "newrepo" ]; then
newrepo "$@";
fi