less_retarded_wiki/make_stats.sh

34 lines
967 B
Bash
Raw Normal View History

2023-12-14 23:38:44 +01:00
#!/bin/sh
# Auto generates stats article.
echo "making stats"
FILE_NAME="wiki_stats.md"
2024-01-12 04:25:07 +01:00
printf "# LRS Wiki Stats\n\nThis is an autogenerated article holding stats about this wiki.\n\n" > $FILE_NAME
2023-12-14 23:38:44 +01:00
printf -- "- number of articles: " >> $FILE_NAME
ls *.md | wc -l >> $FILE_NAME
2024-01-24 18:11:37 +01:00
printf -- "- number of commits: " >> $FILE_NAME
git rev-list --count --all >> $FILE_NAME
2023-12-14 23:38:44 +01:00
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
2024-01-07 03:16:15 +01:00
printf "\nmost wanted pages:\n\n\`\`\`\n" >> $FILE_NAME
./most_wanted.sh >> $FILE_NAME
printf "\`\`\`\n" >> $FILE_NAME
2023-12-14 23:38:44 +01:00
printf "\n" >> $FILE_NAME
# TODO: most wanted links? i.e. most frequent links without article