From 19ef65bd645bf9264ebb43ebd8c617cd5e9d16d7 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Fri, 28 Oct 2022 00:08:53 +0800 Subject: First commit --- wd-journal | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 wd-journal (limited to 'wd-journal') 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" -- cgit v1.2.3