big improvements and bugs

This commit is contained in:
Bendt
2026-01-07 13:08:15 -05:00
parent 86297ae350
commit 0ca266ce1c
6 changed files with 132 additions and 36 deletions

View File

@@ -193,7 +193,12 @@ class DstaskClient(TaskBackend):
due: Optional[datetime] = None,
notes: Optional[str] = None,
) -> Task:
"""Create a new task."""
"""Create a new task.
Notes are added using dstask's / syntax during creation, where
everything after / becomes the note content. Each word must be
a separate argument for this to work.
"""
args = ["add", summary]
if project:
@@ -210,6 +215,13 @@ class DstaskClient(TaskBackend):
# dstask uses various date formats
args.append(f"due:{due.strftime('%Y-%m-%d')}")
# Add notes using / syntax - each word must be a separate argument
# dstask interprets everything after "/" as note content
if notes:
args.append("/")
# Split notes into words to pass as separate arguments
args.extend(notes.split())
result = self._run_command(args)
if result.returncode != 0:
@@ -221,10 +233,6 @@ class DstaskClient(TaskBackend):
# Find task by summary (best effort)
for task in reversed(tasks):
if task.summary == summary:
# Add notes if provided
if notes:
self._run_command(["note", str(task.id), notes])
task.notes = notes
return task
# Return a placeholder if we can't find it