nnote/mnote

13 lines
317 B
Bash
Executable File

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