summaryrefslogtreecommitdiff
path: root/wd-journal
blob: 7f596497d7a1abd90364d5457d0326406b46fea8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

year=$(date +%Y)
week_number=$(date +%W)

overall_title="# Week $week_number $year"
today_title="## $(date '+%Y-%m-%d %A')"

weekly_journal="$WD_JOURNALS_DIR/$year/week$week_number.md"

[ ! -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"