-
Notifications
You must be signed in to change notification settings - Fork 0
/
upcoming
executable file
·43 lines (32 loc) · 904 Bytes
/
upcoming
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
#!/usr/bin/env bash
#: Query the "remind" program for the next three days
function stripDateTime {
sed 's/^[^ ]* //'
}
function messageIfEmpty {
events=$(cat)
if [[ -z $events ]]; then
echo No events or reminders
else
echo $events
fi
}
function underline {
tee >(sed 's/./-/g')
}
TEMPFILE="$(mktemp)"
remind -n -b1 ~/.config/remind | sort > ${TEMPFILE}
TODAY=$(date '+%Y/%m/%d')
date '+Today, %A, %e %B' | underline
grep ${TODAY} ${TEMPFILE} | stripDateTime | messageIfEmpty
echo ""
TOMORROW=$(date -d 'tomorrow' '+%Y/%m/%d')
date -d 'tomorrow' '+Tomorrow, %A, %e %B' | underline
grep ${TOMORROW} ${TEMPFILE} | stripDateTime | messageIfEmpty
echo ""
DAY3=$(date -d '+2 days' '+%Y/%m/%d')
DAY4=$(date -d '+3 days' '+%Y/%m/%d')
DAY5=$(date -d '+4 days' '+%Y/%m/%d')
echo "Coming soon" | underline
grep -e "${DAY3}|${DAY4}|${DAY5}" ${TEMPFILE} | messageIfEmpty
rm ${TEMPFILE}