-
Notifications
You must be signed in to change notification settings - Fork 1
/
tick
executable file
·50 lines (43 loc) · 1.03 KB
/
tick
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Copyright (C) 2009-2017 Serge Hallyn <serge@hallyn.com>
#
# Edit today's tickler file alongside the GTD nextactions file
GTDDIR=~/gtd
CONFIGDIR=~/.config
# User might specify different GTD dir
[ -f "${CONFIGDIR}/gtd/config" ] && . "${CONFIGDIR}/gtd/config"
m=`date +%m`
last="x"
if [ -f "${GTDDIR}/tickler/lastrun" ]; then
last=$(<"${GTDDIR}/tickler/lastrun")
fi
if [ "$last" != "$m" ]; then
echo "Tickler files are out of date"
echo "Running "${GTDDIR}/tickler/update_repeating" is recommended"
read -p "Press enter to continue" x
fi
fmt() {
printf "%02d" $1
}
e=`date +%e`
d=`date +%d`
if [ $e -ne 1 ]; then
y=$((e-1))
unread=""
for i in `seq 1 $y`; do
x=$(fmt $i)
if grep -q XXX "${GTDDIR}/tickler/${x}"; then
unread="${unread} $x"
fi
done
if [ -n "$unread" ]; then
echo "Unhandled tickler files this month: $unread"
read -p "Press enter to continue" x
fi
fi
if [ -s "${GTDDIR}/tickler/$d" ]; then
vim -o "${GTDDIR}/next_actions.otl" "${GTDDIR}/tickler/$d"
else
echo "${GTDDIR}/tickler/$d is empty"
fi