From baa6a99aa959eebfc92a0a9f5445d7978c7b1dad Mon Sep 17 00:00:00 2001 From: Nate Buttke Date: Thu, 3 Mar 2022 09:42:21 -0800 Subject: add plan --- plan | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 plan (limited to 'plan') diff --git a/plan b/plan new file mode 100755 index 0000000..cc4d9ba --- /dev/null +++ b/plan @@ -0,0 +1,52 @@ +#!/bin/bash +#TODO: pandoc --pdf-engine=xelatex jan24.md -o test.pdf + + +if [ "$1" == next ]; then + date=$(date --date="Next Mon" +%b%d | tr A-Z a-z) + lastMonday=$(date --date="Last Mon" +%b%d | tr A-Z a-z) + lastPath="/home/n8/dox/plan/weekly/$lastMonday/$lastMonday" + echo "$lastPath" + printf "Planning for next week.\n" + +else + if date +%a | grep -q Mon ; then + date=$(date --date="This Mon" +%b%d | tr A-Z a-z) # today is monday + printf "today is monday.\n" + else + date=$(date --date="Last Mon" +%b%d | tr A-Z a-z) # today is NOT monday + printf "today is NOT monday.\n" + fi +fi + +filepath="/home/n8/dox/plan/weekly/$date/$date" +directory="/home/n8/dox/plan/weekly/$date/" +template="/home/n8/dox/plan/weekly/template" + + +if [ -n "$1" ]; +then + + if [ "$1" == f ]; then + if [ -f $filepath.md ]; + then + markdown $filepath.md > $filepath.html + firefox $filepath.html + fi + fi + + if [ "$1" == next ]; then + if [ ! -f $filepath.md ]; then + mkdir -p $directory + cp $template.md $filepath.md + + fi + foot -e nvim $filepath.md + fi +else + if [[ $(tty) =~ "not a tty" ]]; then + foot -e nvim $filepath.md + else + nvim $filepath.md + fi +fi -- cgit v1.2.3