Skip to content

Instantly share code, notes, and snippets.

@base698 base698/stats.sh
Last active Aug 12, 2016

Embed
What would you like to do?
Find commits in a workspace for listed languages
#!/bin/bash
source_reg='\b(scala|cpp|js|java|coffee|rb|java|clj|py|groovy|html|ejs|sh|cljs)\b';
awk_counts='{
counts[tolower($1)]++
}
END {
for(type in counts) {
print(type, counts[type])
}
}';
awk_sums='BEGIN {}
{
total+=$2;
counts[$1]+=$2;
}
END {
printf("%-10s %-8s %-8s \n","type", "commits", "percent");
for(type in counts) {
printf("%-10s %-8d %-5.2f \n",type, counts[type], counts[type]*100/total)
}
}';
find . -type d | while read line
do
if ls -a "$line" | egrep '^\.git$'
then
cd "$line"
git log -p -E --author="$1" | grep diff | egrep -o "\.[a-zA-Z]{1,8}" | egrep -io "$source_reg" | awk "$awk_counts"
cd -
fi
done | awk "$awk_sums"
@base698

This comment has been minimized.

Copy link
Owner Author

base698 commented Aug 12, 2016

usage: ./stats.sh justin@email.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.