less_retarded_wiki/make_stats.sh
2024-01-24 18:11:37 +01:00

34 lines
967 B
Bash
Executable file

#!/bin/sh
# Auto generates stats article.
echo "making stats"
FILE_NAME="wiki_stats.md"
printf "# LRS Wiki Stats\n\nThis is an autogenerated article holding stats about this wiki.\n\n" > $FILE_NAME
printf -- "- number of articles: " >> $FILE_NAME
ls *.md | wc -l >> $FILE_NAME
printf -- "- number of commits: " >> $FILE_NAME
git rev-list --count --all >> $FILE_NAME
printf -- "- total size of all texts in bytes: " >> $FILE_NAME
cat *.md | wc -c >> $FILE_NAME
printf "\nlongest articles:\n\n\`\`\`\n" >> $FILE_NAME
ls -1hSs *.md | head -n 10 >> $FILE_NAME
printf "\`\`\`\n" >> $FILE_NAME
printf "\nlatest changes:\n\n\`\`\`\n" >> $FILE_NAME
git log --name-only | head -n 50 | grep "Date:\|.*\.md" >> $FILE_NAME
printf "\`\`\`\n" >> $FILE_NAME
printf "\nmost wanted pages:\n\n\`\`\`\n" >> $FILE_NAME
./most_wanted.sh >> $FILE_NAME
printf "\`\`\`\n" >> $FILE_NAME
printf "\n" >> $FILE_NAME
# TODO: most wanted links? i.e. most frequent links without article