Added verbose flag and made some commands silent
This commit is contained in:
21
gitistics.sh
21
gitistics.sh
@@ -9,13 +9,16 @@ 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="01 Jan 2018"
|
||||||
|
|
||||||
|
# Verbose flag
|
||||||
|
VERBOSE=false
|
||||||
|
|
||||||
# --------------------
|
# --------------------
|
||||||
# --- functions
|
# --- functions
|
||||||
|
|
||||||
# returns the amount of commits for one repository
|
# returns the amount of commits for one repository
|
||||||
function getCommits() {
|
function getCommits() {
|
||||||
# show amount of commits of all users
|
# show amount of commits of all users
|
||||||
committemp=$(git rev-list --count --all --author=$REPOUSER --since="$STARTDATE")
|
committemp=$(git rev-list --count --all --author=$REPOUSER --since="$STARTDATE" 2> /dev/null)
|
||||||
echo $committemp
|
echo $committemp
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +40,9 @@ function getDiffChanges() {
|
|||||||
local exti=${array[1]//[!0-9]}
|
local exti=${array[1]//[!0-9]}
|
||||||
local extd=${array[2]//[!0-9]}
|
local extd=${array[2]//[!0-9]}
|
||||||
|
|
||||||
|
if [ "$VERBOSE" = true ]; then
|
||||||
echo "Files: $extf, Insertions: $exti, Deletions: $extd"
|
echo "Files: $extf, Insertions: $exti, Deletions: $extd"
|
||||||
|
fi
|
||||||
|
|
||||||
local f=$(( extf + __files))
|
local f=$(( extf + __files))
|
||||||
local i=$(( exti + __insert))
|
local i=$(( exti + __insert))
|
||||||
@@ -50,14 +55,17 @@ function getDiffChanges() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
# Switch into the REPODIR
|
# Switch into the REPODIR (silently)
|
||||||
pushd $REPODIR
|
pushd $REPODIR 1> /dev/null
|
||||||
|
|
||||||
# Iterate over all subdirectories
|
# Iterate over all subdirectories
|
||||||
for dir in $REPODIR/*/
|
for dir in $REPODIR/*/
|
||||||
do
|
do
|
||||||
dir=${dir%*/}
|
dir=${dir%*/}
|
||||||
|
|
||||||
|
if [ "$VERBOSE" = true ]; then
|
||||||
echo ${dir##*/}
|
echo ${dir##*/}
|
||||||
|
fi
|
||||||
|
|
||||||
# enter directory
|
# enter directory
|
||||||
cd ${dir##*/}
|
cd ${dir##*/}
|
||||||
@@ -68,7 +76,10 @@ function main() {
|
|||||||
# Add to the total commit counter
|
# Add to the total commit counter
|
||||||
commitcounter=$((commitcounter + commtemp))
|
commitcounter=$((commitcounter + commtemp))
|
||||||
# Output the commit counter of the current iteration
|
# Output the commit counter of the current iteration
|
||||||
|
|
||||||
|
if [ "$VERBOSE" = true ]; then
|
||||||
echo $commtemp
|
echo $commtemp
|
||||||
|
fi
|
||||||
|
|
||||||
getDiffChanges totalfiles totalinsertions totaldeletions
|
getDiffChanges totalfiles totalinsertions totaldeletions
|
||||||
|
|
||||||
@@ -76,8 +87,8 @@ function main() {
|
|||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
|
||||||
# Switch back to the original directory state
|
# Switch back to the original directory state (silently)
|
||||||
popd
|
popd 1> /dev/null
|
||||||
|
|
||||||
|
|
||||||
echo "-------------------------"
|
echo "-------------------------"
|
||||||
|
Reference in New Issue
Block a user