taskli-cli 1.0.0__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/CHANGELOG.md +24 -2
  2. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/PKG-INFO +1 -1
  3. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/reference.md +2 -2
  4. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/tasks.md +33 -4
  5. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/__version__.py +1 -1
  6. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/cli.py +18 -9
  7. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/attributes.py +19 -1
  8. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/dates.py +9 -4
  9. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/query.py +6 -2
  10. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/registry.py +2 -2
  11. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_cli.py +100 -10
  12. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_dates.py +8 -2
  13. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_query.py +7 -0
  14. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_registry.py +22 -0
  15. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/.gitignore +0 -0
  16. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/LICENSE +0 -0
  17. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/README.md +0 -0
  18. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/completions/README.md +0 -0
  19. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/completions/taskli.ps1 +0 -0
  20. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/completions/taskli.sh +0 -0
  21. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/assets/agenda.svg +0 -0
  22. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/assets/details.svg +0 -0
  23. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/assets/filter.svg +0 -0
  24. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/assets/hero.svg +0 -0
  25. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/assets/lists.svg +0 -0
  26. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/assets/quickstart.svg +0 -0
  27. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/assets/states.svg +0 -0
  28. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/completion.md +0 -0
  29. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/config.md +0 -0
  30. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/lists.md +0 -0
  31. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/docs/stability.md +0 -0
  32. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/pyproject.toml +0 -0
  33. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/__init__.py +0 -0
  34. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/env.py +0 -0
  35. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/exceptions.py +0 -0
  36. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/hierarchy.py +0 -0
  37. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/logic.py +0 -0
  38. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/migrations.py +0 -0
  39. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/__init__.py +0 -0
  40. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/config.py +0 -0
  41. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/paths.py +0 -0
  42. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/models/tasks.py +0 -0
  43. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/py.typed +0 -0
  44. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/render.py +0 -0
  45. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/src/taskli/storage.py +0 -0
  46. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/conftest.py +0 -0
  47. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/resources/config_v0_legacy.json +0 -0
  48. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/resources/config_v1.json +0 -0
  49. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/resources/list_v0_legacy.json +0 -0
  50. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/resources/list_v1.json +0 -0
  51. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/test_completions.py +0 -0
  52. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_env.py +0 -0
  53. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_hierarchy.py +0 -0
  54. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_logic.py +0 -0
  55. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_migrations.py +0 -0
  56. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_models.py +0 -0
  57. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_render.py +0 -0
  58. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/unit/test_storage.py +0 -0
  59. {taskli_cli-1.0.0 → taskli_cli-1.0.2}/tests/utils.py +0 -0
@@ -7,8 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.2] - 2026-11-20
11
+
12
+ Version 1.0.1 was never published: its tag name was reserved by an immutable
13
+ release and could not be created. These changes ship as 1.0.2.
14
+
15
+ ### Added
16
+
17
+ - Clear a task's due date with `-e --due none`, `--due ""`, or a bare `--due`.
18
+ On `-a` these are accepted and leave the item undated.
19
+
20
+ ### Fixed
21
+
22
+ - `-e --desc` can now clear a description on Windows shells that drop an empty
23
+ argument: a bare `--desc` or `--desc none` clears it. As a result, a
24
+ description of exactly `none` can no longer be set.
25
+
26
+ ### Changed
27
+
28
+ - A bare or blank `--due` is now an error on the default view (`--due none`
29
+ still lists undated tasks), and `--desc ""` or a bare `--desc` is an error
30
+ there too, where it was previously ignored.
31
+
10
32
  ## [1.0.0] - 2026-11-05
11
- <!-- set the real release date when merging -->
12
33
 
13
34
  1.0 begins the [stability promise](docs/stability.md): the CLI flag grammar and
14
35
  the on-disk schema stay compatible across 1.x.
@@ -81,7 +102,8 @@ the on-disk schema stay compatible across 1.x.
81
102
 
82
103
  - Initial release.
83
104
 
84
- [Unreleased]: https://github.com/calvinmcelvain/taskli/compare/v1.0.0...HEAD
105
+ [Unreleased]: https://github.com/calvinmcelvain/taskli/compare/v1.0.2...HEAD
106
+ [1.0.2]: https://github.com/calvinmcelvain/taskli/compare/v1.0.0...v1.0.2
85
107
  [1.0.0]: https://github.com/calvinmcelvain/taskli/compare/v0.3.0-beta...v1.0.0
86
108
  [0.3.0-beta]: https://github.com/calvinmcelvain/taskli/compare/v0.2.0-beta...v0.3.0-beta
87
109
  [0.2.0-beta]: https://github.com/calvinmcelvain/taskli/compare/v0.1.0-beta...v0.2.0-beta
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: taskli-cli
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Simple CLI for tracking todo lists.
5
5
  Project-URL: Homepage, https://github.com/calvinmcelvain/taskli
6
6
  Project-URL: Repository, https://github.com/calvinmcelvain/taskli
@@ -44,11 +44,11 @@ Modifiers layer on top of an action.
44
44
  | `-p, --priority {low,medium,high}` | Set on `-a`/`-e`; filter on the default view. |
45
45
  | `--tag TAG` (repeatable) | Set on `-a`; **replace** tags on `-e`; filter on the default view. |
46
46
  | `--add-tag TAG` (repeatable) | Append tags on `-e`. Cannot be combined with `--tag`. |
47
- | `--due WHEN` | Set on `-a`/`-e` (one value); filter on the default view (repeatable, OR-combined). See [due dates](tasks.md#due-dates). |
47
+ | `--due WHEN` | Set on `-a`/`-e` (one value); filter on the default view (repeatable, OR-combined). On `-e`, `none`, `""`, or a bare `--due` clears the due date (a no-op on `-a`). A bare `--due` is an error on the default view. See [due dates](tasks.md#due-dates). |
48
48
  | `--today` | Default view only: shorthand for `--due today`. |
49
49
  | `--undated` | Default view only: shorthand for `--due none`. |
50
50
  | `-t, --text TEXT` | New text for `-e`. |
51
- | `--desc TEXT` | Set a description on `-a`/`-e`; `--desc ""` clears it. |
51
+ | `--desc TEXT` | Set a description on `-a`/`-e`. On `-e`, `none`, `""`, or a bare `--desc` clears it (a no-op on `-a`). |
52
52
  | `--under PATH` | With `-a`: nest the new item under `PATH`. With `-e`: re-nest the item; `--under ""` moves it to the top level. |
53
53
  | `--all` | Default view or `--prune`: include sublists (or every list when no `LIST`). |
54
54
 
@@ -59,6 +59,20 @@ tk work -a "Submit timesheet" --due friday
59
59
  tk work -e 3 --due "3 days"
60
60
  ```
61
61
 
62
+ To **clear** a due date, edit the item with `--due none`, `--due ""`, or a
63
+ bare `--due`:
64
+
65
+ ```bash
66
+ tk work -e 3 --due none
67
+ tk work -e 3 --due ""
68
+ tk work -e 3 --due
69
+ ```
70
+
71
+ `none` and a blank value are case-insensitive and ignore surrounding
72
+ whitespace. The bare form exists because some Windows shells drop an
73
+ empty-string argument, so `--due ""` can arrive as a bare `--due`. On `-a`
74
+ these forms are accepted and do nothing: the item is added undated.
75
+
62
76
  The `Due` column turns **red** when an item is overdue and **yellow** when
63
77
  it's due today (done items are never highlighted).
64
78
 
@@ -75,8 +89,10 @@ tk work --undated --due today # undated, or due today
75
89
  tk --today --all # across every list
76
90
  ```
77
91
 
78
- `--due overdue`, `--due none`, `--today`, and `--undated` are filter-only;
79
- `-a`/`-e` reject them. There is no way to clear a due date once set.
92
+ `--due overdue`, `--today`, and `--undated` are filter-only; `-a`/`-e` reject
93
+ them. `--due none` filters for undated items on the default view, but on
94
+ `-a`/`-e` it clears the due date (see above). A bare or blank `--due` is
95
+ rejected on the default view, since there is nothing to filter on.
80
96
 
81
97
  ### Across every list
82
98
 
@@ -90,14 +106,27 @@ above other commands. Turn it off with `tk --config show_reminders false`.
90
106
 
91
107
  ## Descriptions
92
108
 
93
- `--desc` attaches longer notes to an item; `--desc ""` clears it. A dim `¶`
94
- after the task text marks items that have one, and `-D` shows it in full:
109
+ `--desc` attaches longer notes to an item. A dim `¶` after the task text marks
110
+ items that have one, and `-D` shows it in full:
95
111
 
96
112
  ```bash
97
113
  tk work -a "Ship v2 release" --desc "Cut the branch, then tag the build."
98
114
  tk work -D 1
99
115
  ```
100
116
 
117
+ To clear a description, use `-e` with `--desc none`, `--desc ""`, or a bare
118
+ `--desc` (the bare form is there for Windows shells that drop an empty-string
119
+ argument):
120
+
121
+ ```bash
122
+ tk work -e 1 --desc none
123
+ ```
124
+
125
+ > [!NOTE]
126
+ > Because `none` clears, a description that is literally the word "none"
127
+ > can't be set. On `-a` a clear value is accepted and the item is added
128
+ > without a description.
129
+
101
130
  ![Details](assets/details.svg)
102
131
 
103
132
  ## Subtasks
@@ -3,4 +3,4 @@ __all__ = [
3
3
  ]
4
4
 
5
5
 
6
- __version__ = "1.0.0"
6
+ __version__ = "1.0.2"
@@ -135,11 +135,11 @@ def _complete_due_keywords(
135
135
 
136
136
  from .models.dates import DUE_DATE_KEYWORDS, WEEKDAY_INDEX
137
137
 
138
- keywords = [*DUE_DATE_KEYWORDS, *WEEKDAY_INDEX]
138
+ keywords = [*DUE_DATE_KEYWORDS, *WEEKDAY_INDEX, "none"]
139
139
  if not (
140
140
  getattr(parsed_args, "add", None) or getattr(parsed_args, "edit", None)
141
141
  ):
142
- keywords.extend(["overdue", "none"])
142
+ keywords.append("overdue")
143
143
 
144
144
  return keywords
145
145
 
@@ -205,15 +205,19 @@ MODIFIER_FLAGS: dict[str, ModifierSpec] = {
205
205
  dest="due",
206
206
  kwargs={
207
207
  "action": "append",
208
+ "nargs": "?",
209
+ "const": "",
208
210
  "default": [],
209
211
  "metavar": "WHEN",
210
212
  "help": (
211
213
  "Set (with -a/-e) or filter (default view) an"
212
214
  " item's due date. Accepts: today, tomorrow,"
213
- " 'N days', 'next-week', 'N weeks', MM-DD-YYYY."
214
- " Filtering also accepts 'overdue' and 'none'"
215
- " (items with no due date), and may repeat"
216
- " (values OR together)."
215
+ " 'N days', 'next-week', 'N weeks', weekday"
216
+ " names, MM-DD-YYYY. With -e, 'none', \"\" or a"
217
+ " bare --due clears the due date (no-op with"
218
+ " -a). Filtering also accepts 'overdue' and"
219
+ " 'none' (items with no due date), and may"
220
+ " repeat (values OR together)."
217
221
  ),
218
222
  },
219
223
  completer=_complete_due_keywords,
@@ -270,11 +274,13 @@ MODIFIER_FLAGS: dict[str, ModifierSpec] = {
270
274
  dest="desc",
271
275
  kwargs={
272
276
  "type": str,
277
+ "nargs": "?",
278
+ "const": "",
273
279
  "default": None,
274
280
  "metavar": "TEXT",
275
281
  "help": (
276
- "Set (with -a/-e) an item's description; pass an"
277
- " empty string to clear it. -a/-e only."
282
+ "Set an item's description. -a/-e only. With -e,"
283
+ " a bare --desc, \"\" or 'none' clears it."
278
284
  ),
279
285
  },
280
286
  ),
@@ -655,7 +661,8 @@ def _reject_modifiers(
655
661
  for arg in spec.args
656
662
  }
657
663
  for dest in sorted(flags.keys() - allowed):
658
- if getattr(namespace, dest):
664
+ # not a truthiness check: a bare --desc / --under "" is "".
665
+ if getattr(namespace, dest) not in (None, [], False):
659
666
  parser.error(f"{flags[dest]} is not valid with {context}.")
660
667
 
661
668
  return None
@@ -781,6 +788,8 @@ def _validate(
781
788
  parser.error("--config takes at most KEY and VALUE.")
782
789
  _reject_modifiers(namespace, parser, "--config", set())
783
790
  case ListCommands.VIEW:
791
+ if any(not value.strip() for value in namespace.due):
792
+ parser.error("--due needs a value on the default view.")
784
793
  _reject_modifiers(
785
794
  namespace,
786
795
  parser,
@@ -5,7 +5,25 @@ from dataclasses import dataclass
5
5
  from enum import Enum, StrEnum
6
6
  from typing import assert_never
7
7
 
8
- __all__ = ["Color", "Operator", "Priority", "Status"]
8
+ __all__ = ["Color", "Operator", "Priority", "Status", "is_clear_token"]
9
+
10
+
11
+ def is_clear_token(raw: str) -> bool:
12
+ """Report whether a modifier value means "clear this attribute".
13
+
14
+ Parameters
15
+ ----------
16
+ raw : str
17
+ The user-supplied modifier value.
18
+
19
+ Returns
20
+ -------
21
+ bool
22
+ ``True`` for an empty or whitespace-only string, or ``"none"``
23
+ in any case.
24
+ """
25
+
26
+ return raw.strip().casefold() in {"", "none"}
9
27
 
10
28
 
11
29
  class Color(StrEnum):
@@ -4,6 +4,7 @@ import re
4
4
  from datetime import date, datetime, timedelta
5
5
 
6
6
  from ..exceptions import InvalidModifierValueError
7
+ from .attributes import is_clear_token
7
8
 
8
9
  __all__ = ["parse_agenda_window", "parse_due_date", "today"]
9
10
 
@@ -61,21 +62,25 @@ def midnight(value: date) -> datetime:
61
62
  return datetime(value.year, value.month, value.day)
62
63
 
63
64
 
64
- def parse_due_date(raw: str) -> datetime:
65
+ def parse_due_date(raw: str) -> datetime | None:
65
66
  """Parse a due-date modifier value to a midnight datetime.
66
67
 
67
68
  Parameters
68
69
  ----------
69
70
  raw : str
70
71
  The user-supplied value, e.g. ``"tomorrow"``, ``"3 days"``, or
71
- ``"04-15-2026"``.
72
+ ``"04-15-2026"``; ``""`` or ``"none"`` means clear the date.
72
73
 
73
74
  Returns
74
75
  -------
75
- datetime
76
- The resolved calendar day at midnight (no time component).
76
+ datetime | None
77
+ The resolved calendar day at midnight (no time component), or
78
+ ``None`` when ``raw`` is a clear token.
77
79
  """
78
80
 
81
+ if is_clear_token(raw):
82
+ return None
83
+
79
84
  text = raw.strip()
80
85
  keyword = text.casefold()
81
86
 
@@ -7,7 +7,7 @@ from dataclasses import dataclass
7
7
  from datetime import timedelta
8
8
  from typing import TYPE_CHECKING
9
9
 
10
- from ..exceptions import InvalidConfigValueError
10
+ from ..exceptions import InvalidConfigValueError, InvalidModifierValueError
11
11
  from . import registry
12
12
  from .attributes import Operator
13
13
  from .dates import midnight, parse_agenda_window, parse_due_date, today
@@ -197,9 +197,13 @@ def due_to_criteria(raw: str) -> tuple[Criterion, ...]:
197
197
  Criterion("done", Operator.EQ, False),
198
198
  )
199
199
 
200
+ due = parse_due_date(raw)
201
+ if due is None:
202
+ raise InvalidModifierValueError("a --due filter needs a value.")
203
+
200
204
  # parse_due_date midnight-normalizes its result, so this exact-datetime
201
205
  # match agrees with _due_render_style's calendar-day comparison.
202
- return (Criterion("due_date", Operator.EQ, parse_due_date(raw)),)
206
+ return (Criterion("due_date", Operator.EQ, due),)
203
207
 
204
208
 
205
209
  def agenda_criteria(
@@ -8,7 +8,7 @@ from datetime import datetime
8
8
  from functools import cache
9
9
  from typing import TYPE_CHECKING, Literal
10
10
 
11
- from .attributes import Operator, Priority
11
+ from .attributes import Operator, Priority, is_clear_token
12
12
  from .dates import parse_due_date, today
13
13
 
14
14
  if TYPE_CHECKING:
@@ -76,7 +76,7 @@ ATTRIBUTES: dict[str, Attribute] = {
76
76
  ),
77
77
  "description": Attribute(
78
78
  name="description",
79
- parse=lambda s: s or None,
79
+ parse=lambda s: None if is_clear_token(s) else s,
80
80
  modifier_ops=frozenset({"add", "edit"}),
81
81
  ),
82
82
  "priority": Attribute(
@@ -945,12 +945,49 @@ class TestDue:
945
945
  assert "bravo" in captured.out
946
946
  assert "charlie" not in captured.out
947
947
 
948
- def test_rejects_none_on_set_path(self, taskli_env, capsys):
949
- exit_code = main(["work", "-a", "x", "--due", "none"])
948
+ @pytest.mark.parametrize(
949
+ "due_args",
950
+ [["--due", "none"], ["--due", ""], ["--due"]],
951
+ ids=["none", "empty", "bare"],
952
+ )
953
+ def test_add_clear_token_adds_undated_item(self, taskli_env, due_args):
954
+ exit_code = main(["work", "-a", "x", *due_args])
955
+
956
+ assert exit_code == 0
957
+ item = load_list(taskli_env, "work").items[0]
958
+ assert item.text == "x"
959
+ assert item.due_date is None
960
+
961
+ @pytest.mark.parametrize(
962
+ "due_args",
963
+ [["--due", "none"], ["--due", ""], ["--due"]],
964
+ ids=["none", "empty", "bare"],
965
+ )
966
+ def test_edit_clear_token_clears_due(self, taskli_env, capsys, due_args):
967
+ main(["work", "-a", "taxes", "--due", "tomorrow"])
968
+ before = load_list(taskli_env, "work").items[0].modified_at
969
+ capsys.readouterr()
970
+
971
+ exit_code = main(["work", "-e", "1", *due_args])
950
972
 
951
973
  captured = capsys.readouterr()
952
- assert exit_code == 1
953
- assert "MM-DD-YYYY" in captured.out + captured.err
974
+ assert exit_code == 0
975
+ assert "updated #1 in 'work'" in captured.out
976
+ item = load_list(taskli_env, "work").items[0]
977
+ assert item.due_date is None
978
+ assert item.modified_at != before
979
+
980
+ @pytest.mark.parametrize(
981
+ "due_args",
982
+ [["--due"], ["--due", ""], ["--due", " "]],
983
+ ids=["bare", "empty", "whitespace"],
984
+ )
985
+ def test_view_blank_due_errors(self, taskli_env, capsys, due_args):
986
+ exit_code = main(["work", *due_args])
987
+
988
+ captured = capsys.readouterr()
989
+ assert exit_code == 2
990
+ assert "--due needs a value on the default view." in captured.err
954
991
 
955
992
  def test_config_default_sort_by_due_orders_none_last(
956
993
  self, taskli_env, capsys
@@ -1180,6 +1217,42 @@ class TestDesc:
1180
1217
  item = load_list(taskli_env, "work").items[0]
1181
1218
  assert item.description is None
1182
1219
 
1220
+ @pytest.mark.parametrize(
1221
+ "desc_args",
1222
+ [["--desc", "none"], ["--desc", "NONE"], ["--desc"]],
1223
+ ids=["none", "none-caps", "bare"],
1224
+ )
1225
+ def test_edit_clear_token_clears_description(self, taskli_env, desc_args):
1226
+ main(["work", "-a", "migrate", "--desc", "old note"])
1227
+
1228
+ exit_code = main(["work", "-e", "1", *desc_args])
1229
+
1230
+ assert exit_code == 0
1231
+ item = load_list(taskli_env, "work").items[0]
1232
+ assert item.description is None
1233
+
1234
+ @pytest.mark.parametrize(
1235
+ "desc_args",
1236
+ [["--desc", "none"], ["--desc"]],
1237
+ ids=["none", "bare"],
1238
+ )
1239
+ def test_add_clear_token_leaves_description_unset(
1240
+ self, taskli_env, desc_args
1241
+ ):
1242
+ exit_code = main(["work", "-a", "migrate", *desc_args])
1243
+
1244
+ assert exit_code == 0
1245
+ item = load_list(taskli_env, "work").items[0]
1246
+ assert item.text == "migrate"
1247
+ assert item.description is None
1248
+
1249
+ def test_add_stores_none_prefixed_text_verbatim(self, taskli_env):
1250
+ exit_code = main(["work", "-a", "migrate", "--desc", "nonesuch"])
1251
+
1252
+ assert exit_code == 0
1253
+ item = load_list(taskli_env, "work").items[0]
1254
+ assert item.description == "nonesuch"
1255
+
1183
1256
 
1184
1257
  class TestDetails:
1185
1258
  def test_shows_task_detail(self, taskli_env, capsys):
@@ -2424,17 +2497,34 @@ class TestFlagCombinations:
2424
2497
  assert exit_code == 2
2425
2498
  assert "-e/--edit takes one --due value." in captured.err
2426
2499
 
2427
- def test_empty_desc_on_view_is_ignored_not_rejected(
2428
- self, taskli_env, capsys
2500
+ @pytest.mark.parametrize(
2501
+ "argv",
2502
+ [
2503
+ ["work", "--desc", ""],
2504
+ ["work", "--desc"],
2505
+ ["work", "--prune", "--desc"],
2506
+ ["work", "-d", "1", "--desc"],
2507
+ ["work", "-d", "1", "--desc", ""],
2508
+ ],
2509
+ ids=[
2510
+ "view-empty",
2511
+ "view-bare",
2512
+ "prune-bare",
2513
+ "done-bare",
2514
+ "done-empty",
2515
+ ],
2516
+ )
2517
+ def test_empty_desc_rejected_where_not_valid(
2518
+ self, taskli_env, capsys, argv
2429
2519
  ):
2430
2520
  main(["work", "-a", "task"])
2431
2521
  capsys.readouterr()
2432
2522
 
2433
- exit_code = main(["work", "--desc", ""])
2523
+ exit_code = main(argv)
2434
2524
 
2435
2525
  captured = capsys.readouterr()
2436
- assert exit_code == 0
2437
- assert "task" in captured.out
2526
+ assert exit_code == 2
2527
+ assert "--desc is not valid with" in captured.err
2438
2528
 
2439
2529
  def test_config_with_three_args_errors(self, taskli_env, capsys):
2440
2530
  exit_code = main(["--config", "a", "b", "c"])
@@ -2606,5 +2696,5 @@ class TestCompletion:
2606
2696
  assert "today" in keywords
2607
2697
  assert "next-week" in keywords
2608
2698
  assert "monday" in keywords
2699
+ assert "none" in keywords
2609
2700
  assert ("overdue" in keywords) is expects_overdue
2610
- assert ("none" in keywords) is expects_overdue
@@ -57,10 +57,17 @@ class TestParseDueDate:
57
57
  def test_accepts(self, raw, expected):
58
58
  assert parse_due_date(raw) == expected
59
59
 
60
+ @pytest.mark.parametrize(
61
+ "raw",
62
+ ["none", "None", " NONE ", "", " "],
63
+ ids=["none", "none-caps", "none-padded-caps", "empty", "whitespace"],
64
+ )
65
+ def test_clear_token_returns_none(self, raw):
66
+ assert parse_due_date(raw) is None
67
+
60
68
  @pytest.mark.parametrize(
61
69
  "raw",
62
70
  [
63
- "",
64
71
  "overdue",
65
72
  "someday",
66
73
  "2026-04-15",
@@ -71,7 +78,6 @@ class TestParseDueDate:
71
78
  "mondays",
72
79
  ],
73
80
  ids=[
74
- "empty",
75
81
  "overdue",
76
82
  "someday",
77
83
  "iso",
@@ -332,6 +332,13 @@ class TestDueToCriteria:
332
332
 
333
333
  assert [i.text for i in result] == ["undated"]
334
334
 
335
+ @pytest.mark.parametrize("raw", ["", " "], ids=["empty", "whitespace"])
336
+ def test_rejects_blank_token(self, monkeypatch, raw):
337
+ freeze_today(monkeypatch, date(2026, 3, 10))
338
+
339
+ with pytest.raises(InvalidModifierValueError):
340
+ due_to_criteria(raw)
341
+
335
342
  def test_rejects_unparseable_token(self, monkeypatch):
336
343
  freeze_today(monkeypatch, date(2026, 3, 10))
337
344
 
@@ -255,5 +255,27 @@ class TestModifiers:
255
255
 
256
256
  assert parse("high") is Priority.HIGH
257
257
 
258
+ @pytest.mark.parametrize(
259
+ "raw",
260
+ ["", "none", "NONE", " None "],
261
+ ids=["empty", "none", "none-caps", "none-padded"],
262
+ )
263
+ def test_description_parse_clears_token(self, raw):
264
+ parse = ATTRIBUTES["description"].parse
265
+ assert parse
266
+
267
+ assert parse(raw) is None
268
+
269
+ @pytest.mark.parametrize(
270
+ "raw",
271
+ ["note", "nonesuch", "none of it"],
272
+ ids=["plain", "none-prefix", "none-phrase"],
273
+ )
274
+ def test_description_parse_passes_text_through(self, raw):
275
+ parse = ATTRIBUTES["description"].parse
276
+ assert parse
277
+
278
+ assert parse(raw) == raw
279
+
258
280
  def test_tags_has_no_parse(self):
259
281
  assert ATTRIBUTES["tags"].parse is None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes