aboutsummaryrefslogtreecommitdiff
path: root/src/sb
blob: 640cad6161f3989dfcf6f99efe2e34d33270343c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env zsh

STROKE_BUDDY_DIR=~/.local/stroke_buddy
TODAY=`date -I`

function count_for_date {
	lines=0

	for hourly_file in $STROKE_BUDDY_DIR/"$1"*; do
		hourly_presses=$(cat $hourly_file \
			| grep keypresses \
			| cut -d',' -f2)

		lines=$(($lines+$hourly_presses))
	done

	echo $lines
}

if [ -n "$1" ]; then
	TODAY=$1
fi

echo $(count_for_date $TODAY)