#!/bin/bash #TODO: pandoc --pdf-engine=xelatex jan24.md -o test.pdf if [ "$1" == next ]; then printf "Planning for next week.\n" fi if date +%a | grep -q Mon ; then # today is monday date=$(date --date="This Mon" +%b%d | tr A-Z a-z) printf "today is monday.\n" else # today is NOT monday date=$(date --date="Last Mon" +%b%d | tr A-Z a-z) printf "today is NOT monday.\n" fi if [ "$1" == next ]; then date=$(date --date="$date + 1 week" +%b%d | tr A-Z a-z) fi filepath="/home/n8/dox/plan/weekly/$date/$date" directory="/home/n8/dox/plan/weekly/$date/" template="/home/n8/dox/plan/weekly/template" openPlan(){ # Create file if it is not there if [ ! -f $filepath.md ]; then mkdir -p $directory cp $template.md $filepath.md fi if [[ $(tty) =~ "not a tty" ]]; then foot -e nvim $filepath.md else nvim $filepath.md fi } if [ -n "$1" ]; then if [ "$1" == f ]; then if [ -f $filepath.md ]; then markdown $filepath.md > $filepath.html firefox $filepath.html fi else openPlan fi fi