From 5e6ab6854f3ad7ebdf16e14fe9066c17894cdaf6 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 4 Jun 2025 16:26:46 +0200 Subject: [PATCH 1/4] ref: Use recommended subprocess method to edit --- topen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/topen.py b/topen.py index 7585d5a..a13b444 100755 --- a/topen.py +++ b/topen.py @@ -93,8 +93,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}") - proc = subprocess.Popen(f"{editor} {file}", shell=True) - _ = proc.wait() + _ = subprocess.run(f"{editor} {file}", shell=True) def add_annotation_if_missing(task: Task, annotation_content: str) -> None: From 1652e018853a13b3d01cfc9d4541483bd153e11d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 4 Jun 2025 17:09:47 +0200 Subject: [PATCH 2/4] doc: Add better cli option metavar annotations --- topen.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/topen.py b/topen.py index a13b444..19fc757 100755 --- a/topen.py +++ b/topen.py @@ -190,6 +190,7 @@ you view the task. _ = parser.add_argument( "-d", "--notes-dir", + metavar="DIR", help="Location of topen notes files", ) _ = parser.add_argument( @@ -197,15 +198,22 @@ you view the task. action="store_true", help="Silence any verbose displayed information", ) - _ = parser.add_argument("--extension", help="Extension of note files") + _ = parser.add_argument( + "--extension", metavar="EXT", help="Extension of note files" + ) _ = parser.add_argument( "--annotation", + metavar="NOTE", help="Annotation content to set within taskwarrior", ) - _ = parser.add_argument("--editor", help="Program to open note files with") - _ = parser.add_argument("--task-rc", help="Location of taskwarrior config file") _ = parser.add_argument( - "--task-data", help="Location of taskwarrior data directory" + "--editor", metavar="CMD", help="Program to open note files with" + ) + _ = parser.add_argument( + "--task-rc", metavar="FILE", help="Location of taskwarrior config file" + ) + _ = parser.add_argument( + "--task-data", metavar="DIR", help="Location of taskwarrior data directory" ) p = parser.parse_args() From 09d996eb15bb9ab11407bc026103932d1bc6a725 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 15 Sep 2025 10:50:14 +0200 Subject: [PATCH 3/4] doc: Change suggestion for trying script to versioned release To try the script we should suggest the stable versioned release not the main trunk. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72b81f1..81ddcfc 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Or just manually copy the `topen` file to a directory in your PATH. [tasklib](https://github.com/GothenburgBitFactory/tasklib) is the only dependency aside from the python standard library. If you just want to try the script out, -feel free to do so by invoking it e.g. with `uvx git+https://git.martyoeh.me/Marty/topen.git`. +feel free to do so by invoking it e.g. with `uvx topen`. If you want to install the trunk version instead of a versioned release simply substitute for the git path: From 5724c8888d5e981d5280c2e7ad01da1fc67b41b3 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 15 Sep 2025 10:53:34 +0200 Subject: [PATCH 4/4] doc: Improve introduction reading flow --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 81ddcfc..69645da 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,12 @@ A script without bells and whistles. Focuses on letting you quickly: -- create notes for taskwarrior tasks -- edit notes for taskwarrior tasks +- create new notes for taskwarrior tasks +- edit existing notes for taskwarrior tasks It does both by simply being invoked with `topen `. -Provide a taskwarrior task id or uuid and `topen` creates a new note file or lets -you edit an existing one. Additionally it adds a small annotation to the task -to let you see that there exists a note file next time you view the task. - -Should just work as-is without additional configuration in most modern taskwarrior setups. - -Can be configured through environment variables or cli options, see below. - -Can be used as-is with the `topen` command or directly from taskwarrior by being aliased in your `taskrc`: +Or it can be used directly from taskwarrior by being aliased in your `taskrc`: ```conf alias.note=exec topen @@ -30,8 +22,16 @@ alias.note=exec topen And you can open any note with your usual taskwarrior workflow, by doing `task note `. +Provide a taskwarrior task id or uuid and `topen` creates a new note file or lets +you edit an existing one. Additionally it adds a small annotation to the task +to let you see that there exists a note file next time you view the task. + That's all there is to it. +Everything should just work as-is without additional configuration in most modern taskwarrior setups. + +But if you want, many settings can be configured through your taskrc file, environment variables, or cli options, see below. + ## Installation You can install the script with your favorite python environment manager: