summaryrefslogtreecommitdiff
path: root/wd-journal
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-11-01 10:13:24 +0800
committerGuangxiong Lin <[email protected]>2022-11-01 10:13:24 +0800
commit9d806fd9bf0f84a1362884d289896ab220395e5a (patch)
treef0b4d2c44559a72c52bd78c322a59e9c0c96cc15 /wd-journal
parent88985762ec88f51fb8aa89cf115b4a822a87f0b0 (diff)
downloadwd-0.0.4.tar.gz
wd-0.0.4.tar.bz2
wd-0.0.4.zip
Add create journal file flowv0.0.4
Diffstat (limited to 'wd-journal')
-rwxr-xr-xwd-journal9
1 files 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"