From 6a46c28a10f600f75f2cf603c7cc5b916738fe8d Mon Sep 17 00:00:00 2001 From: Keanu Date: Fri, 4 Jun 2021 22:11:19 +0200 Subject: [PATCH] [scripts/category-count] Add script. --- scripts/category-count | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/category-count diff --git a/scripts/category-count b/scripts/category-count new file mode 100755 index 0000000..2c5d296 --- /dev/null +++ b/scripts/category-count @@ -0,0 +1,24 @@ +#!/usr/bin/env zsh +# Script to fetch commit messages and display the category frequencies. +# Example: +# 047c36c [Meta] Added README. +# 5b16912 [Init] Added scripts. +# +# Will output: +# Meta: 1 +# Init: 1 +# +# Authored by: +# Alyxia Sother +# Mijyuoon + +data=$(git log --oneline | awk -F '[][]' '{for (i=2; i<=NF; i+=2) {printf "%s ", $i}; print ""}') +keys=$(echo "$data" | sort -u | uniq) + +for type in $data; do + eval "count_$type="'$'"((count_$type+1))" +done + +for type in $keys; do + echo "$type: $(eval "echo "'$'"count_$type")" +done