nnote/ynote

13 lines
310 B
Plaintext
Raw Normal View History

2024-08-29 16:25:23 +00:00
#!/usr/bin/env bash
set -euo pipefail
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
NOTENAME="${1:-yearly}"
DATEDIR="$NOTESDIR/$(date +%Y)"
mkdir -p "$DATEDIR"
NOTEPATH="$DATEDIR/$NOTENAME"
echo "$NOTEPATH"
if ! [ -f "$NOTEPATH" ]; then
printf "$NOTENAME for $(date +%Y)\n---\n\n" > "$NOTEPATH"
fi
$EDITOR "$NOTEPATH"