feat: Inform user if no file was written
Some checks failed
website / build (push) Has been cancelled
website / deploy (push) Has been cancelled

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.
This commit is contained in:
Marty Oehme 2025-11-11 19:58:46 +01:00
parent 5724c8888d
commit a088fcbe76
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 7 additions and 1 deletions

View file

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
- Inform user that no annotation is added if they do not write any file
### Fixed ### 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. - 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.

View file

@ -69,6 +69,8 @@ def main():
if fpath.exists(): if fpath.exists():
add_annotation_if_missing(task, annotation_content=cfg.notes_annot) 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: 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: def open_editor(file: Path, editor: str) -> None:
"""Opens a file with the chosen editor.""" """Opens a file with the chosen editor."""
_ = whisper(f"Editing note: {file}") whisper(f"Editing note: {file}")
_ = subprocess.run(f"{editor} {file}", shell=True) _ = subprocess.run(f"{editor} {file}", shell=True)