diff options
| author | godosa <godosa@godosa.eu> | 2026-10-07 07:46:19 +0200 |
|---|---|---|
| committer | godosa <godosa@godosa.eu> | 2026-10-07 07:46:19 +0200 |
| commit | 71d1b0d84d0a2c55a4698c83788fa1f9e901ea35 (patch) | |
| tree | 192692ab690f6d7103f22dff4f70a814e27b262e | |
| parent | 9d5641fe6585a61894f7b7427a68c794e5efe76d (diff) | |
| download | workflow-71d1b0d84d0a2c55a4698c83788fa1f9e901ea35.tar.gz workflow-71d1b0d84d0a2c55a4698c83788fa1f9e901ea35.zip | |
wf done on awaiting item: -m writes archive line
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JEAjUkQRrCYX5MZhWxdtj2
| -rw-r--r-- | tests/test_cli.py | 5 | ||||
| -rwxr-xr-x | wf.py | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py index 43135c9..75737b4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -410,6 +410,11 @@ class DoneTest(Cli): self.assertEqual(self.item("t-two"), "- **t-two** [P2] (5h): Second thing.\n") self.assertEqual(self.archive(), ARCHIVE) + def test_done_awaiting_with_m_archives(self): + out = self.ok("done", "a-key", "-m", "approved by owner") + self.assertEqual(out.splitlines()[0], "removed: a-key → tasks/archive.md") + self.assertRegex(self.archive().splitlines()[2], rf"^- {TODAY} \*\*a-key\*\* .* — approved by owner$") + def test_done_unknown(self): self.assertRegex(self.fails("done", "t-on", "-m", "x"), r"^wf: unknown id 't-on' \(nearest: t-one") self.assertEqual(self.archive(), ARCHIVE) @@ -1100,8 +1100,11 @@ def cmd_done(args) -> int: solo = [i for i in task_ids if doc.item(i).sessions == "solo"] for id in args.ids: if id.startswith("a-"): - tasks.remove(doc, id) - out.append(f"removed: {id}") + item = tasks.remove(doc, id) + if args.m: + line = tasks.archive_line(today, item, args.m) + p.new_archive = tasks.archive_prepend(p.new_archive or p.archive_text, line) + out.append(f"removed: {id}" + (f" → {p.cfg.rel(p.cfg.archive)}" if args.m else "")) freed = tasks.unblock(doc, id) if freed: out.append("unblocked: " + ", ".join(freed)) |
