Last active
December 19, 2015 23:59
-
-
Save tharna/6038568 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 zsh | |
function get_user { git config user.email } | |
user=$(get_user) | |
since="1 day ago" | |
total=0 | |
today="today" | |
onlytotal=0 | |
while getopts "tu:s:" option | |
do | |
case $option in | |
t) | |
onlytotal=1 | |
;; | |
u) | |
user=$OPTARG | |
;; | |
s) | |
since=$OPTARG | |
today="since $since" | |
;; | |
esac | |
done | |
cd $projects_path | |
cat /$GIT_REPO_DIR/.git_index | while read line | |
do | |
for i in $=line | |
do | |
cd $i | |
eval $'commits=( ${(s.\n.)"$(git log --pretty=oneline --since="$since" --author=$user | wc -l)"} )' | |
if [ $commits -eq 0 ]; then | |
echo "${RED}No commits in project ${CYAN}${i%/repo}${RED} $today!${NO_COLOR}" | |
elif [ $onlytotal -eq 1 ]; then | |
echo "${CYAN}$commits${NO_COLOR} commits in project ${CYAN}${i%/repo}${RED}" | |
else | |
echo "##### Changes in project ${CYAN}${i%/repo}${NO_COLOR} #####" | |
git log --pretty=oneline --abbrev-commit --all --decorate --since="$since" --author=$user | |
fi | |
((total = total + commits )) | |
done | |
done | |
echo "$user has made $total commits since $today." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment