A bash script to replace gtimelog for the terminal

I have been using this script to log my time for a long time, thought I would share it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Usage:
# log time
# $ gl browsing redding again
# $ gl finished Hugo recipe for zammu.in
#
# check log
# $ gl
#
# check last 2 logs
# $ gl t -n2
#
# edit the timelog file
# $ gl e

function gl() {
gtimelog=~/timelog.txt

[ $# -eq 0 ] && tail $gtimelog $2 && return

case $1 in
t|c) tail $gtimelog $2
;;
a) echo "$(date "+%Y-%m-%d %H:%M"): $(tail -1 $gtimelog | sed -e 's/^[0-9 :-]*//g')" >> $gtimelog
;;
e) vi $gtimelog
;;
*) echo "$(date "+%Y-%m-%d %H:%M"): ${@/jj/**}" >> $gtimelog
;;
esac
}

I am currently working on LiveForm which makes setting up contact forms on your website a breeze.