taskli-cli 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl
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.
- taskli/__version__.py +1 -1
- taskli/cli.py +18 -9
- taskli/models/attributes.py +19 -1
- taskli/models/dates.py +9 -4
- taskli/models/query.py +6 -2
- taskli/models/registry.py +2 -2
- {taskli_cli-1.0.0.dist-info → taskli_cli-1.0.2.dist-info}/METADATA +1 -1
- {taskli_cli-1.0.0.dist-info → taskli_cli-1.0.2.dist-info}/RECORD +14 -14
- {taskli_cli-1.0.0.data → taskli_cli-1.0.2.data}/data/share/taskli/completions/README.md +0 -0
- {taskli_cli-1.0.0.data → taskli_cli-1.0.2.data}/data/share/taskli/completions/taskli.ps1 +0 -0
- {taskli_cli-1.0.0.data → taskli_cli-1.0.2.data}/data/share/taskli/completions/taskli.sh +0 -0
- {taskli_cli-1.0.0.dist-info → taskli_cli-1.0.2.dist-info}/WHEEL +0 -0
- {taskli_cli-1.0.0.dist-info → taskli_cli-1.0.2.dist-info}/entry_points.txt +0 -0
- {taskli_cli-1.0.0.dist-info → taskli_cli-1.0.2.dist-info}/licenses/LICENSE +0 -0
taskli/__version__.py
CHANGED
taskli/cli.py
CHANGED
|
@@ -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.
|
|
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',
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
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
|
|
277
|
-
"
|
|
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
|
-
|
|
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,
|
taskli/models/attributes.py
CHANGED
|
@@ -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):
|
taskli/models/dates.py
CHANGED
|
@@ -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
|
|
taskli/models/query.py
CHANGED
|
@@ -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,
|
|
206
|
+
return (Criterion("due_date", Operator.EQ, due),)
|
|
203
207
|
|
|
204
208
|
|
|
205
209
|
def agenda_criteria(
|
taskli/models/registry.py
CHANGED
|
@@ -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
|
|
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(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
taskli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
taskli/__version__.py,sha256=
|
|
3
|
-
taskli/cli.py,sha256=
|
|
2
|
+
taskli/__version__.py,sha256=ZBeiPuPLukwrUbOtwLF8-ettolVtqJhm5YqZ00HrJHg,57
|
|
3
|
+
taskli/cli.py,sha256=wEIq0sx9IekxRYOUqAnu7QeJy5vc7qFEMqlCiMp29Iw,33520
|
|
4
4
|
taskli/env.py,sha256=o6rgyCdndXG5Q2zMtZHfeKydAjWhD555XMupuf6igQY,959
|
|
5
5
|
taskli/exceptions.py,sha256=mM8FCX6Ec4qmlfQnwvyXRJGHNXYgyOgBBGRDZhDvX4s,1935
|
|
6
6
|
taskli/hierarchy.py,sha256=O7FyvwvYihXQkKVxfuw_AqBEXMUqBzbwKbwbCfB9Y9E,1956
|
|
@@ -10,18 +10,18 @@ taskli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
10
10
|
taskli/render.py,sha256=hI_y_R5Q13DgAe98tr_rBtz3E88f6jkELqIZvPrHfw8,13912
|
|
11
11
|
taskli/storage.py,sha256=hVMXkNzkN2zkIAdKeu7Dj4XSAgvPgdLJ15B0gYydGIY,18397
|
|
12
12
|
taskli/models/__init__.py,sha256=UFOa06BIfrM2Ds3yruQpnVRuqgWQETP4WGFaF6CrYKo,59
|
|
13
|
-
taskli/models/attributes.py,sha256=
|
|
13
|
+
taskli/models/attributes.py,sha256=ivtaD_7hGWBfZiAujneho9mnkWvhDDGQT3_de4gg57M,4103
|
|
14
14
|
taskli/models/config.py,sha256=rh7ZjSnulO9szUGWsZXXxNQwBKWbHULYoCWwvLPiTV4,2924
|
|
15
|
-
taskli/models/dates.py,sha256=
|
|
15
|
+
taskli/models/dates.py,sha256=QVLQqqLqr5EhiIxsD6uy4AQaHZ0N6RoCeH9jcKBnnA8,3841
|
|
16
16
|
taskli/models/paths.py,sha256=yYQK4x2KWEroXqWyLLBtalMZHaCzvL4tZ20VVpmJ1Vc,508
|
|
17
|
-
taskli/models/query.py,sha256=
|
|
18
|
-
taskli/models/registry.py,sha256=
|
|
17
|
+
taskli/models/query.py,sha256=54I7qcwGrTZRlrO5L3nonkHDjoRHF58mv8m20gI0MxQ,7103
|
|
18
|
+
taskli/models/registry.py,sha256=cAfCjatmiHGAyvQJpm-486fJS-Okum0BIqLtdmRoB8M,5965
|
|
19
19
|
taskli/models/tasks.py,sha256=NzjVTPB3If_-lMX-zycdsm1njP77lS_sndvw0B45clQ,21712
|
|
20
|
-
taskli_cli-1.0.
|
|
21
|
-
taskli_cli-1.0.
|
|
22
|
-
taskli_cli-1.0.
|
|
23
|
-
taskli_cli-1.0.
|
|
24
|
-
taskli_cli-1.0.
|
|
25
|
-
taskli_cli-1.0.
|
|
26
|
-
taskli_cli-1.0.
|
|
27
|
-
taskli_cli-1.0.
|
|
20
|
+
taskli_cli-1.0.2.data/data/share/taskli/completions/README.md,sha256=oxCOXak3Pn_bAejwzHApIng0xmU0De3tTPn0yks5x8A,1439
|
|
21
|
+
taskli_cli-1.0.2.data/data/share/taskli/completions/taskli.ps1,sha256=HzRUOuyZo5NX-iL5b-0GbfvXbsfMj81oiWZN0ptNeug,1786
|
|
22
|
+
taskli_cli-1.0.2.data/data/share/taskli/completions/taskli.sh,sha256=lAP3lrIhkeqirbMIxXarLPsVcsiN7Hah9nVaPd5DCds,2688
|
|
23
|
+
taskli_cli-1.0.2.dist-info/METADATA,sha256=Kz0nUiUlJ197JEJTEOrOz3fJF0z1uoA7cvBL6UOKves,8240
|
|
24
|
+
taskli_cli-1.0.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
25
|
+
taskli_cli-1.0.2.dist-info/entry_points.txt,sha256=Z39GyfESyq9VPtm46MzcH-nKG-Cnd_6QrDN1aoTSQEg,64
|
|
26
|
+
taskli_cli-1.0.2.dist-info/licenses/LICENSE,sha256=3yY4oiDyvR0wN6_OEE4kljKgab45nVJHiNfUin1CkPA,1075
|
|
27
|
+
taskli_cli-1.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|