diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/task/taskwarrior-tui/annotate-with-new-note | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/task/taskwarrior-tui/annotate-with-new-note')
| -rwxr-xr-x | debian/.local/bin/task/taskwarrior-tui/annotate-with-new-note | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/debian/.local/bin/task/taskwarrior-tui/annotate-with-new-note b/debian/.local/bin/task/taskwarrior-tui/annotate-with-new-note new file mode 100755 index 0000000..3c67d24 --- /dev/null +++ b/debian/.local/bin/task/taskwarrior-tui/annotate-with-new-note @@ -0,0 +1,41 @@ +#!/bin/sh + +# UUID of the task to annotate +uuid="$*" + +# Directory where notes are stored +notes_dir="$HOME/Private/repos/Obsidian/SI/Notes" +templates_dir="$HOME/Private/repos/Obsidian/SI/Resources/Templates" + +# Prompt for the new note name +printf "Enter the name for the new note: " +read -r new_note_name + +copy_note="$templates_dir/projects.md" +filepath="$notes_dir/$new_note_name.md" + +# Check if a file with this name already exists +if [ -f "$filepath" ]; then + echo "File with this name already exists. Annotating the task with the existing note." +else + nvim -n -c "ObsidianNew $new_note_name" --headless >/dev/null 2>&1 & + if [ -f "$copy_note" ]; then + cp "$copy_note" "$filepath" + echo "New note created and opened in Neovim." + fi +fi + +# Annotate the task with the filepath +task_output=$(task rc.bulk=0 rc.confirmation=off "$uuid" annotate "$filepath") + +# Check if annotation was successful +case "$task_output" in +*"Annotated"*) + echo "Successfully annotated the task with the note." + ;; +*) + echo "Failed to annotate the task." + ;; +esac + +${EDITOR:-nvim} "$filepath" |
