modify to count for text file

This commit is contained in:
soffolk 2013-05-18 17:45:17 +08:00
parent 0386eb5bbe
commit dbc9fe0be4

View file

@ -8,7 +8,9 @@ project=${PWD##*/}
function single_file {
while read data
do
git blame --line-porcelain $data | sed -n 's/^author //p'
if [[ $(file $data) = *text ]]; then #
git blame --line-porcelain $data | sed -n 's/^author //p';
fi
done
}
@ -40,8 +42,10 @@ function result {
authors | awk '
{ args[NR] = $0; sum += $0 }
END {
printf " %-9s: %i\n", "lines", sum
printf " %-9s: \n", "authors"
for (i = 1; i <= NR; ++i) {
printf "%-30s %2.1f%%\n", args[i], 100 * args[i] / sum
printf " %-30s %2.1f%%\n", args[i], 100 * args[i] / sum
}
}
'
@ -51,8 +55,6 @@ function result {
echo
echo " project : $project"
echo " lines :" $(count)
echo " authors : "
result
echo