#!/usr/bin/env sh

# Based on day script from mischavandenburg 
# url: https://github.com/mischavandenburg/dotfiles/blob/main/scripts/day

today=$(date +"%Y-%m-%d")
tomorrow=$(date -d "tomorrow" '+%Y-%m-%d')
yesterday=$(date -d "yesterday" '+%Y-%m-%d')
file="$SECOND_BRAIN"'/periodic/daily/'"$today.md"

cd "$SECOND_BRAIN" || exit 1

new_note() {
	touch "$file"

    # Give me a nice format
    cat <<EOF >"$file"
# $today

[[$yesterday]] - [[$tomorrow]]

## Intention

What do I want to achieve today and tomorrow?

## Tracking

- [ ] Cycle
- [ ] Strength training
- [ ] Watch a movie or tv show episode
- [ ] Play/finish a game
- [ ] Post a blog post
- [ ] Check servers
- [ ] Check backups

## Log
EOF
}

if [ ! -f "$file" ]; then
    new_note
fi

nvim '+ normal Gzzo' "$file"