forked from zachfedor/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
review
executable file
·101 lines (70 loc) · 1.94 KB
/
review
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh
# --------------------- #
# Weekly Review Process #
# --------------------- #
# setup
CURRENT="${HOME}/wiki/review/current.md"
NOW=$( date +%Y.%W )
NOWFILE="${HOME}/wiki/review/${NOW}.md"
PAST=$( date -v-1w +%Y.%W )
PASTFILE="${HOME}/wiki/review/${PAST}.md"
NEXT=$( date -v+1w +%Y.%W )
# check for current review file at path above
if ! [ -f $CURRENT ]; then
echo "Sorry, can't find your current review."
exit 1
fi
# check for previous review file at path above
if [ -f $PASTFILE ]; then
# last week's review has been completed so we need to end the current
# review at ${NOW} and start the new review at ${NEXT}
echo "Last week's review was already completed. See " + ${PASTFILE}
echo
read -rp "Would you like to end the current review now and create next week's review? y/n " answer
case ${answer:0:1} in
y|Y )
END=${NOW}
ENDFILE=${NOWFILE}
START=${NEXT}
;;
* )
exit 1
;;
esac
else
# last week's review is not yet completed, so let's do it now. end current
# review at ${PAST} and start new review at ${NOW}
END=${PAST}
ENDFILE=${PASTFILE}
START=${NOW}
fi
# grab previous review from current file
echo "Completing Review for ${END}..."
# paste it into it's own archive
sed -n '/^-----/,$ {//!p;}' ${CURRENT} | sed '1d' > ${ENDFILE}
# will edit/append later
# replace previous review with blank review template
echo "Starting Review for ${START}..."
# TODO: hook up a quote API to replace the quote every week
cat << EOF > ${CURRENT}
# Current Review
The best laid plans of mice and men often go awry.
*Plan Anyway!*
-----
# ${START}
## Goals:
- [ ]
## Time:
- Work:
- People:
- Elective - Productive:
- Elective - Play:
- Health:
- Sleep:
## Review:
EOF
# time to edit/append both files accordingly
vim ${ENDFILE} ${CURRENT}
# exit
echo
echo "Good work. A planned week makes a prepared person."