Compare commits

..

No commits in common. "5724c8888d5e981d5280c2e7ad01da1fc67b41b3" and "7dbd93796d7de7812223d3cc7f375ca0ae3c8a51" have entirely different histories.

2 changed files with 18 additions and 25 deletions

View file

@ -8,12 +8,20 @@
A script without bells and whistles.
Focuses on letting you quickly:
- create new notes for taskwarrior tasks
- edit existing notes for taskwarrior tasks
- create notes for taskwarrior tasks
- edit notes for taskwarrior tasks
It does both by simply being invoked with `topen <task-id>`.
Or it can be used directly from taskwarrior by being aliased in your `taskrc`:
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`:
```conf
alias.note=exec topen
@ -22,16 +30,8 @@ alias.note=exec topen
And you can open any note with your usual taskwarrior workflow,
by doing `task note <id>`.
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:
@ -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 topen`.
feel free to do so by invoking it e.g. with `uvx git+https://git.martyoeh.me/Marty/topen.git`.
If you want to install the trunk version instead of a versioned release simply substitute for the git path:

View file

@ -93,7 +93,8 @@ 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}")
_ = subprocess.run(f"{editor} {file}", shell=True)
proc = subprocess.Popen(f"{editor} {file}", shell=True)
_ = proc.wait()
def add_annotation_if_missing(task: Task, annotation_content: str) -> None:
@ -190,7 +191,6 @@ you view the task.
_ = parser.add_argument(
"-d",
"--notes-dir",
metavar="DIR",
help="Location of topen notes files",
)
_ = parser.add_argument(
@ -198,22 +198,15 @@ you view the task.
action="store_true",
help="Silence any verbose displayed information",
)
_ = parser.add_argument(
"--extension", metavar="EXT", help="Extension of note files"
)
_ = parser.add_argument("--extension", 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(
"--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"
"--task-data", help="Location of taskwarrior data directory"
)
p = parser.parse_args()