summaryrefslogtreecommitdiff
path: root/wd-journal
diff options
context:
space:
mode:
Diffstat (limited to 'wd-journal')
-rwxr-xr-xwd-journal17
1 files changed, 17 insertions, 0 deletions
diff --git a/wd-journal b/wd-journal
new file mode 100755
index 0000000..e56d357
--- /dev/null
+++ b/wd-journal
@@ -0,0 +1,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"