Created
September 28, 2021 04:45
-
-
Save niclin/2e07c0eab91263b184a5e7aeca22236b to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -o errexit | |
green='\033[0;32m' | |
no_color='\033[0m' | |
ok() { | |
echo -e "$green$1$no_color" | |
} | |
ok "計算今年疫情期間 commit 數量 (2021/05/13 ~ 2021/09/26)" | |
covid19_period=`git rev-list --count --since="2021-05-13" --before="2021-09-26" --all --no-merges` | |
covid19_before=`git rev-list --count --since="2020-12-28" --before="2021-05-13" --all --no-merges` | |
echo -e "疫情期間 commit 數量 $green$covid19_period$no_color 共計 136 天" | |
echo -e "往前反推 136 天的 commit 數為 $green$covid19_before" | |
if (($covid19_period > $covid19_before)) | |
then | |
ok "結果:疫情期間 多於 往前反推 136 天" | |
else | |
ok "結果:疫情期間 少於 往前反推 136 天" | |
fi | |
echo -e "---------------------------" | |
ok "計算去年同時期 commit 數量 (2020/05/13 ~ 2020/09/26)" | |
last_year=`git rev-list --count --since="2020-05-13" --before="2020-09-26" --all --no-merges` | |
echo -e "疫情期間 commit 數量 $green$covid19_period$no_color " | |
echo -e "去年同日期的 commit 數為 $green$last_year" | |
if (($covid19_period > $last_year)) | |
then | |
ok "結果:疫情期間 多於 去年同時期" | |
else | |
ok "結果:疫情期間 少於 去年同時期" | |
fi | |
echo -e "---------------------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment