Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adomani committed May 18, 2024
1 parent 5730c66 commit af6ae39
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions scripts/mathlib_stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ getCountDecls () {
sed -z 's=, *=,\n=g; s=[ [#]==g; s=]=,=g; s=\n\n*=\n=g'
}

tallyCountDecls () {
awk 'BEGIN{ count=0 }
/[^,]$/ { count++; type[count]=$0; acc[count]=0; }
/,$/ { acc[count]++ } END{
for(t=1; t<=count; t++) { printf("%s %s\n", type[t], acc[t]) }
}' "${1}"
}

# the output of `count_decls`
newDeclsTots="$(getCountDecls)"
newDecls="$(echo "${newDeclsTots}" | awk 'BEGIN{ count=0 }
/[^,]$/ { count++; type[count]=$0; acc[count]=0; }
/,$/ { acc[count]++ } END{
for(t=1; t<=count; t++) { printf("%s %s\n", type[t], acc[t]) }
}')"

# the tally of the output of `count_decls`
newDecls="$(echo "${newDeclsTots}" | tallyCountDecls -)"
# Definitions 73590...
git checkout -q "${oldCommit}"
# 'detached HEAD' state
Expand All @@ -64,11 +71,7 @@ git checkout -q origin/adomani/periodic_reports_dev_custom_action scripts/count_
oldDeclsTots="$(getCountDecls)"

# the tally of the output of `count_decls`
oldDecls="$(echo "${oldDeclsTots}" | awk 'BEGIN{ count=0 }
/[^,]$/ { count++; type[count]=$0; acc[count]=0; }
/,$/ { acc[count]++ } END{
for(t=1; t<=count; t++) { printf("%s %s\n", type[t], acc[t]) }
}')"
oldDecls="$(echo "${oldDeclsTots}" | tallyCountDecls -)"
# Definitions 73152...

# produce the `+X -Y` report for the declarations in each category
Expand Down

0 comments on commit af6ae39

Please sign in to comment.