From 9d806fd9bf0f84a1362884d289896ab220395e5a Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Tue, 1 Nov 2022 10:13:24 +0800 Subject: Add create journal file flow --- wd-journal | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wd-journal b/wd-journal index 8022125..7f59649 100755 --- a/wd-journal +++ b/wd-journal @@ -3,12 +3,15 @@ year=$(date +%Y) week_number=$(date +%W) -title="## $(date '+%Y-%m-%d %A')" +overall_title="# Week $week_number $year" +today_title="## $(date '+%Y-%m-%d %A')" weekly_journal="$WD_JOURNALS_DIR/$year/week$week_number.md" -if ! grep -q "$title" "$weekly_journal"; then - echo "$title" >> "$weekly_journal" +[ ! -f "$weekly_journal" ] && echo "$overall_title" > "$weekly_journal" + +if ! grep -q "$today_title" "$weekly_journal"; then + echo "$today_title" >> "$weekly_journal" fi $EDITOR "$WD_JOURNALS_DIR/$year/week$week_number.md" -- cgit v1.2.3