diff options
author | Guangxiong Lin <[email protected]> | 2022-10-28 00:08:53 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2022-10-28 00:08:53 +0800 |
commit | 19ef65bd645bf9264ebb43ebd8c617cd5e9d16d7 (patch) | |
tree | 78e1615612069b5972a4c8620a5182f9c6f27836 /wd-journal | |
download | wd-0.0.1.tar.gz wd-0.0.1.tar.bz2 wd-0.0.1.zip |
First commitv0.0.1
Diffstat (limited to 'wd-journal')
-rwxr-xr-x | wd-journal | 17 |
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" |