-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.sh
42 lines (31 loc) · 869 Bytes
/
cmd.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
37
38
39
40
41
42
dates=$1
count=$2
year=$3
# transform into dates array
IFS=',' read -ra DATES_ARRAY <<< "$dates"
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'
echo "${BLUE}[INFO]${NC} Start running dumb thing"
YEAR="$year"
DEFAULT_REPO_PATH="../../empty-repo-nerd-commit-$YEAR/"
REPO_PATH="${4:-$DEFAULT_REPO_PATH}"
if [ ! -d "$REPO_PATH" ]; then
echo "Commit Repo not found. Please ensure the directory exists."
exit 1
fi
cd $REPO_PATH
loop_commit() {
# variable should be a date starting with month and divided by . (e.g. "09.25")
for i in $(seq 1 $count)
do
git commit --allow-empty -m "This is a NERD COMMIT" --date="$YEAR.$1 16:20"
done
}
for date in "${DATES_ARRAY[@]}"; do
loop_commit "$date"
done
# Finish it and push
git push origin main
echo "${GREEN}[SUCCESS]${NC} Script finished! Check your github graph :)"