less_retarded_wiki/make_stats.sh
2023-12-14 23:38:44 +01:00

27 lines
758 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 auto-generated article holding stats about this wiki.\n\n" > $FILE_NAME
printf -- "- number of articles: " >> $FILE_NAME
ls *.md | wc -l >> $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 "\n" >> $FILE_NAME
# TODO: most wanted links? i.e. most frequent links without article