Run with "review" ($0 review), and you will get a rundown of complete and incomplete tasks for the week.
Run with "review" ($0 review), and you will get a rundown of complete and incomplete tasks for the week.
Optionally, supply with date-compatible strings as "$0 review <start> [end] to use a range, end defaults to yesterday
Optionally, supply with date-compatible strings as "$0 review <start> [end] to use a range, end defaults to yesterday
A task is considered complete if it matches the regex /^ \*/ and incomplete matching /* \-/
A task is considered complete if it matches the regex /^ \*/ and incomplete matching /* \-/
events are also printed, assuming ! below
I've also implemented /^ ~/, implying a continuing task (as opposed to - which I'm sort of considering "not only incomplete, but barely progressed/attempted").
For the purposes of review, ~ counts as Completed.
I'm hoping to capture which tasks are is under-estimated.
Events are also printed, assuming ! below
Notes are generally ignored, but can be started with "^ #", "^ ;", or "^ !" for future functionality
Notes are generally ignored, but can be started with "^ #", "^ ;", or "^ !" for future functionality
This will evolve with use, but generally (and in order of importance)
This will evolve with use, but generally (and in order of importance)
@ -65,9 +69,9 @@ function review() {
for j in '*' '-' '!'; do
for j in '*|~' '-' '!'; do
case $j in
case $j in
\*) echo "Completed Tasks:";;
\*|\~) echo "Completed Tasks:";;
\-) echo "Incomplete Tasks:";;
\-) echo "Incomplete Tasks:";;
\!) echo "Events:";;
\!) echo "Events:";;
esac
esac
@ -117,12 +121,21 @@ function captains_log() {
TODAY=$(date +%F)
TODAY=$(date +%F)
TOMORROW=$(date +%F -d "+${modT:-1} day")
TOMORROW=$(date +%F -d "+${modT:-1} day")
if [ ${GIT:-1} ] && [ -f "$CLDIR/.git" ]; then
GIT=1
else
GIT=0
fi
if ! [ -d "$CLDIR" ]; then
if ! [ -d "$CLDIR" ]; then
mkdir "$CLDIR"
mkdir "$CLDIR"
fi
fi
if [ $GIT ]; then
git -C "$CLDIR" pull &
fi
# Create files if they don't exist
# Create files if they don't exist
for i in YESTERDAY TODAY TOMORROW; do
for i in YESTERDAY TODAY TOMORROW; do
if ! [ -f "$CLDIR/${!i}" ]; then
if ! [ -f "$CLDIR/${!i}" ]; then
@ -130,14 +143,14 @@ function captains_log() {
# If it's not executable, replate {{DATE <date-compatible formate>}} with said date/formate
# If it's not executable, replate {{DATE <date-compatible formate>}} with said date/formate
if [ "$DATE_ARGS"=='' ]; then DATE_ARGS='%A %d %B %Y'; fi
if [ "$DATE_ARGS"=='' ]; then DATE_ARGS='%A %d %B %Y'; fi
debug "From static template with DATE_ARGS=$DATE_ARGS"
debug "From static template with DATE_ARGS=$DATE_ARGS"
sed 's/{{DATE[^}]*}}/$(date "+$DATE_ARGS" -d ${!i})/g' $CLDIR/template > $CLDIR/${!i}
sed "s/{{DATE[^}]*}}/$(date "+$DATE_ARGS" -d ${!i})/g" $CLDIR/template > $CLDIR/${!i}
else
else
echo -e "$(date "+%A %d %B %Y" -d ${!i})\nWhat do you want to accomplish today?\n\nWhat are your notes for today?\n\nWhat do you need to follow up tomorrow?\n" > "$CLDIR/${!i}"
echo -e "$(date "+%A %d %B %Y" -d ${!i})\nWhat do you want to accomplish today?\n\nWhat are your notes for today?\n\nWhat do you need to follow up tomorrow?\n" > "$CLDIR/${!i}"
fi
fi
@ -157,7 +170,7 @@ function captains_log() {
if ! grep -qE "^Scheduled to Review today:" "$CLDIR/${!i}"; then
if ! grep -qE "^Scheduled to Review today:" "$CLDIR/${!i}"; then
echo "Scheduled to Review today:" >> "$CLDIR/${!i}"
echo "Scheduled to Review today:" >> "$CLDIR/${!i}"
fi
fi
if ! grep -qE "^ - $TASK" "$CLDIR/${!i}";then
if ! grep -qE "^ . $TASK" "$CLDIR/${!i}";then
echo " - $TASK" >> "$CLDIR/${!i}"
echo " - $TASK" >> "$CLDIR/${!i}"
fi
fi
@ -181,6 +194,14 @@ function captains_log() {
vi -O $CLDIR/{$YESTERDAY,$TODAY,$TOMORROW}
vi -O $CLDIR/{$YESTERDAY,$TODAY,$TOMORROW}
if [ $GIT ]; then
if [ $( git -C "$CLDIR" status -s |wc -l) -ne 0 ]; then
git -C "$CLDIR" add -A
git -C "$CLDIR" commit -m "Audo-Commit by $(basename $0)"