forked from antfu/1990-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.sh
executable file
·36 lines (31 loc) · 991 Bytes
/
index.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env sh
_() {
YEAR="1970"
echo "GitHub Username: "
read -r USERNAME
echo "GitHub Access token: "
read -r ACCESS_TOKEN
echo "Type your e-mail (to set commit e-mail, leave blank to skip): "
read -r EMAIL
echo "Type your name (to set git username, leave blank to skip): "
read -r GIT_USERNAME
[ -z "$USERNAME" ] && exit 1
[ -z "$ACCESS_TOKEN" ] && exit 1
[ ! -d $YEAR ] && mkdir $YEAR
cd "${YEAR}" || exit
git init
[ -n "$EMAIL" ] && git config user.email "${EMAIL}"
[ -n "$GIT_USERNAME" ] && git config user.name "${GIT_USERNAME}"
git add .
GIT_AUTHOR_DATE="${YEAR}-01-01T00:00:00.000Z" \
GIT_COMMITTER_DATE="${YEAR}-01-01T00:00:00.000Z" \
git commit --allow-empty -m "1970"
git remote add origin "https://${ACCESS_TOKEN}@github.com/${USERNAME}/${YEAR}.git"
git branch -M main
git push -u origin main -f
cd ..
rm -rf "${YEAR}"
echo
echo "Cool, check your profile now: https://github.com/${USERNAME}"
} && _
unset -f _