From 62483472b517c1b4a43f3ac8e010055d919f6b37 Mon Sep 17 00:00:00 2001 From: Malte Tammena Date: Mon, 26 Feb 2024 10:32:38 +0100 Subject: [PATCH] feat(user/malte): note script, show what I did today --- scripts/note.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/note.sh b/scripts/note.sh index 33e1566..ac5eb83 100755 --- a/scripts/note.sh +++ b/scripts/note.sh @@ -29,6 +29,8 @@ function print_help_and_exit() { printf "Arguments:\n" printf " todo | todos [TAG]\n" printf " Show only todos, optionally filtered by #TAG\n" + printf " done | did\n" + printf " Show only todos that I did today\n" printf " day | today\n" printf " Show only todays entry\n" printf " -1 | -2 | -3\n" @@ -37,6 +39,7 @@ function print_help_and_exit() { } ONLY_TODOS= +ONLY_DONE= ONLY_DAY= FILTER_TAG= @@ -50,6 +53,11 @@ while [[ $# -gt 0 ]]; do shift fi ;; + done | did) + ONLY_TODOS=1 + ONLY_DONE=1 + shift # past argument + ;; day | today) ONLY_DAY=today shift # past argument @@ -80,6 +88,13 @@ bat "$XDG_DATA_HOME/life.md/$year.md" | else cat fi + } | + { + if [ -n "$ONLY_DONE" ]; then + rg "^- \[[xX]\] " | rg "done:$(date +%Y-%m-%d)" + else + cat + fi } elif [ -n "$ONLY_DAY" ]; then rg --multiline --multiline-dotall "# $(date -d "$ONLY_DAY" +%Y-%m-%d)(.*?\n#[^#]|.*)"