aboutsummaryrefslogtreecommitdiffziptar.gz
diff options
context:
space:
mode:
-rw-r--r--tests/test_cli.py5
-rwxr-xr-xwf.py7
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)
diff --git a/wf.py b/wf.py
index 4b901ab..15b5e2d 100755
--- a/wf.py
+++ b/wf.py
@@ -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))