feat: Only annotate tasks if note file was created

In the case of opening the notes but then backing out again without
actually writing a notes file we should also not annotate the task with
anything, since it technically still does not have a note.
This commit is contained in:
Marty Oehme 2025-04-08 20:06:25 +02:00
parent caec33120c
commit 9d5fa3e244
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -57,11 +57,12 @@ def main():
if not uuid:
_ = sys.stderr.write(f"Could not find task for ID: {cfg.task_id}.")
sys.exit(1)
fname = get_notes_file(uuid, notes_dir=cfg.notes_dir, notes_ext=cfg.notes_ext)
fpath = get_notes_file(uuid, notes_dir=cfg.notes_dir, notes_ext=cfg.notes_ext)
open_editor(fname, editor=cfg.notes_editor)
open_editor(fpath, editor=cfg.notes_editor)
add_annotation_if_missing(task, annotation_content=cfg.notes_annot)
if fpath.exists():
add_annotation_if_missing(task, annotation_content=cfg.notes_annot)
def get_task(id: str | int, data_location: Path) -> Task: