From a088fcbe762e587b37c0aea238ecc4749752056c Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 11 Nov 2025 19:58:46 +0100 Subject: [PATCH] feat: Inform user if no file was written When the user exits the note-writing editor process without having written any file, we also don't attach an annotation to the corresponding task since it would lead nowhere. This small change makes this condition obvious to the user, by informing them that the program is 'doing nothing' when they exit the editor without having saved a file. --- CHANGELOG.md | 4 ++++ topen.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dee7329..797aa47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Inform user that no annotation is added if they do not write any file + ### Fixed - Default paths are only calculated once, though users can now not use specifically '%%%%I_DONT_EXIST_%%%%' as a path for the taskrc file and task data directory. diff --git a/topen.py b/topen.py index 19fc757..dcfb350 100755 --- a/topen.py +++ b/topen.py @@ -69,6 +69,8 @@ def main(): if fpath.exists(): add_annotation_if_missing(task, annotation_content=cfg.notes_annot) + return + whisper("No note file, doing nothing.") def get_task(id: str | int, data_location: Path) -> Task: @@ -92,7 +94,7 @@ def get_notes_file(uuid: str, notes_dir: Path, notes_ext: str) -> Path: def open_editor(file: Path, editor: str) -> None: """Opens a file with the chosen editor.""" - _ = whisper(f"Editing note: {file}") + whisper(f"Editing note: {file}") _ = subprocess.run(f"{editor} {file}", shell=True)