summaryrefslogtreecommitdiff
path: root/wd-journal
blob: e56d3576a63376ed51c17d7ea5fcb84a3897de73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

notes_dir=${NB_NOTE_DIR:-"$HOME/notes"}
journals_dir="$notes_dir/journals"

year=$(date +%Y)
week_number=$(date +%W)

title="## $(date '+%Y-%m-%d %A')"

weekly_journal="$journals_dir/$year/week$week_number.md"

if ! grep -q "$title" "$weekly_journal"; then
    echo "$title" >> "$weekly_journal"
fi

$EDITOR "$journals_dir/$year/week$week_number.md"