Added -s <date> flag

This commit is contained in:
2019-01-06 18:41:06 +01:00
parent baac253f2f
commit 4f978ec26b

View File

@@ -8,7 +8,7 @@ REPOUSER=$(whoami)
#REPOUSER="\(structix\|Janek\)" #REPOUSER="\(structix\|Janek\)"
# Specify the start date, where the statistics should be gathered # Specify the start date, where the statistics should be gathered
STARTDATE="01 Jan 2018" STARTDATE="1 year ago"
# Verbose flag # Verbose flag
VERBOSE=false VERBOSE=false
@@ -102,7 +102,7 @@ function main() {
echo "-------------------------" echo "-------------------------"
echo "Total commits since $STARTDATE: $commitcounter" echo "Total commits starting from $STARTDATE: $commitcounter"
echo "Total files changed: $totalfiles" echo "Total files changed: $totalfiles"
echo "Total insertions: $totalinsertions" echo "Total insertions: $totalinsertions"
echo "Total deletions: $totaldeletions" echo "Total deletions: $totaldeletions"
@@ -119,14 +119,16 @@ print_usage() {
echo "-h show this help page" echo "-h show this help page"
echo "-u <user/regex> set a repository username or a regex pattern (brackets etc. must be escaped with \ )" echo "-u <user/regex> set a repository username or a regex pattern (brackets etc. must be escaped with \ )"
echo "-r <directory> set a directory with your repositories" echo "-r <directory> set a directory with your repositories"
echo "-s <date> set the date (e.g. 01 JAN 2018) where the stats should start"
echo "-v show verbose output" echo "-v show verbose output"
} }
# process the arguments # process the arguments
while getopts 'u:r:vh' flag; do while getopts 'u:r:s:vh' flag; do
case "${flag}" in case "${flag}" in
u) REPOUSER="${OPTARG}" ;; u) REPOUSER="${OPTARG}" ;;
r) REPODIR="${OPTARG}" ;; r) REPODIR="${OPTARG}" ;;
s) STARTDATE="${OPTARG}" ;;
v) VERBOSE=true ;; v) VERBOSE=true ;;
h) print_usage; exit 0 ;; h) print_usage; exit 0 ;;
*) print_usage *) print_usage