From 78a71ecbb74df02991a1be3fc1dd5c26c8e11d9a Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 23 Apr 2025 01:15:05 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-23 01:15:05 --- .config/fish/functions/jrnl.fish | 78 +++++++++++++++++++------------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/.config/fish/functions/jrnl.fish b/.config/fish/functions/jrnl.fish index 7a1b4d35..29417045 100644 --- a/.config/fish/functions/jrnl.fish +++ b/.config/fish/functions/jrnl.fish @@ -36,42 +36,58 @@ function jrnl --description 'Lightweight journaling tool' mkdir -p $jdir end + set template $jdir/.template.md + + if not test -f $template + set -l prompt "There is no template, create one now? (y/n): " + while read --nchars 1 -l response --prompt-str="$prompt" or return 1 + printf "\033[1A\033[2K" + switch $response + case y Y + begin + echo "# $(date +'%A, %b %d, %Y')"\n + + echo "## Gratitude"\n + + echo "I'm grateful for ..."\n + + echo "## + Wins"\n + + echo "- small_victories"\n + + echo "## - Challenges"\n + + echo "- hard_things"\n + + echo "## Reflection"\n + + echo "_One sentence to reflect on today:_"\n + + echo "- reflection"\n + + echo "## Learned"\n + + echo "- fact_insight_or_skill"\n + + echo "## Tomorrow"\n + + echo "- prep"\n + end >$template + eval $EDITOR $template + set -f new_template + case n N + break + end + end + + end + # get the date set today (date +'%Y-%m-%d') set entry "$jdir/$today.md" # check if journal entry exists if not test -f $entry - set -l template \ - "# $(date +'%A, %b %d, %Y') - -## Gratitude - -I'm grateful for ... - -## + Wins - -- small_victories - -## - Challenges - -- hard_things - -## Reflection - -_One sentence to reflect on today:_ - -- reflection - -## Learned - -- fact_insight_or_skill - -## Tomorrow - -- prep - -" - echo $template >$entry + cat $template >$entry set -l prompt "Created $entry, open in $EDITOR? (y/n)" while read --nchars 1 -l response --prompt-str="$prompt" or return 1 printf "\033[1A\033[2K"