diff --git a/gitistics.sh b/gitistics.sh index 261334d..e030b51 100755 --- a/gitistics.sh +++ b/gitistics.sh @@ -1,7 +1,7 @@ #!/bin/bash # Specify a directory with all Git repositories -REPODIR=~/Git +REPODIR=$(pwd) # Regex or fixed name (brackets need to be escaped with a backslash) REPOUSER="\(structix\|Janek\)" @@ -10,7 +10,7 @@ REPOUSER="\(structix\|Janek\)" STARTDATE="01 Jan 2018" # Verbose flag -VERBOSE=true +VERBOSE=false # -------------------- # --- functions @@ -107,5 +107,29 @@ function main() { echo "Total deletions: $totaldeletions" } + + + + +# process the arguments +print_usage() { + echo "$0 - git statistics over multiple directories" + echo "" + echo "options:" + echo "-h show this help page" + echo "-r set a directory with your repositories" + echo "-v show verbose output" +} + +while getopts 'r:vh' flag; do + case "${flag}" in + r) REPODIR="${OPTARG}" ;; + v) VERBOSE=true ;; + h) print_usage; exit 0 ;; + *) print_usage + exit 1 ;; + esac +done + # Start the main function main