worklogs 0.3.2__tar.gz → 0.3.4__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.
- {worklogs-0.3.2 → worklogs-0.3.4}/PKG-INFO +1 -1
- {worklogs-0.3.2 → worklogs-0.3.4}/pyproject.toml +1 -1
- {worklogs-0.3.2 → worklogs-0.3.4}/src/worklogs/__init__.py +1 -1
- {worklogs-0.3.2 → worklogs-0.3.4}/src/worklogs/cli.py +11 -7
- {worklogs-0.3.2 → worklogs-0.3.4}/tests/test_package.py +10 -10
- {worklogs-0.3.2 → worklogs-0.3.4}/uv.lock +1 -1
- {worklogs-0.3.2 → worklogs-0.3.4}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/.github/workflows/ci.yml +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/.github/workflows/release.yml +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/.gitignore +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/.pre-commit-config.yaml +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/.python-version +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/AGENTS.md +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/README.md +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/docs/api.md +0 -0
- {worklogs-0.3.2 → worklogs-0.3.4}/src/worklogs/py.typed +0 -0
|
@@ -140,6 +140,7 @@ def _configure_logging() -> None:
|
|
|
140
140
|
if use_color:
|
|
141
141
|
try:
|
|
142
142
|
import colorlog
|
|
143
|
+
|
|
143
144
|
handler.setFormatter(
|
|
144
145
|
colorlog.ColoredFormatter(_COLOR_FORMAT, log_colors=_LOG_COLORS)
|
|
145
146
|
)
|
|
@@ -168,10 +169,10 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
168
169
|
if args.command == "find":
|
|
169
170
|
return _run_find(args)
|
|
170
171
|
except WorklogsError as error:
|
|
171
|
-
|
|
172
|
+
LOGGER.error("%s", error)
|
|
172
173
|
return 2
|
|
173
174
|
|
|
174
|
-
|
|
175
|
+
LOGGER.error("unknown command: %s", args.command)
|
|
175
176
|
return 2
|
|
176
177
|
|
|
177
178
|
|
|
@@ -282,7 +283,7 @@ def _run_find(args: argparse.Namespace) -> int:
|
|
|
282
283
|
|
|
283
284
|
def _find_plan_by_name(name: str, root: Path) -> Path:
|
|
284
285
|
"""Find a plan file by name slug, erroring on zero or multiple matches."""
|
|
285
|
-
pattern = f"*/*/*/*/[0-9]
|
|
286
|
+
pattern = f"*/*/*/*/[0-9]*--{name}--plan.md"
|
|
286
287
|
matches = sorted(root.glob(pattern))
|
|
287
288
|
if not matches:
|
|
288
289
|
raise WorklogsError(
|
|
@@ -534,14 +535,17 @@ def _build_entries(
|
|
|
534
535
|
def _entry_path(
|
|
535
536
|
*, identity: WorklogIdentity, config: WorklogConfig, now: datetime
|
|
536
537
|
) -> Path:
|
|
537
|
-
"""Compute the file path
|
|
538
|
+
"""Compute the file path for a worklog entry."""
|
|
539
|
+
hour12 = int(now.strftime("%I"))
|
|
540
|
+
period = "a" if now.hour < 12 else "p"
|
|
541
|
+
time_prefix = f"{now:%H%M}-{hour12}{period}"
|
|
538
542
|
return (
|
|
539
543
|
config.root
|
|
540
544
|
/ config.scope
|
|
541
545
|
/ f"{now:%Y}"
|
|
542
|
-
/ f"{now:%m}"
|
|
543
|
-
/ f"{now:%d}"
|
|
544
|
-
/ f"{
|
|
546
|
+
/ f"{now:%m}-{now:%B}".lower()
|
|
547
|
+
/ f"{now:%d}-{now:%A}".lower()
|
|
548
|
+
/ f"{time_prefix}--{identity.name}--{identity.kind}.md"
|
|
545
549
|
)
|
|
546
550
|
|
|
547
551
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Tests for worklogs CLI — HHMM--name--kind.md format."""
|
|
1
|
+
"""Tests for worklogs CLI — HHMM-Hp/a--name--kind.md format."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -28,7 +28,7 @@ if TYPE_CHECKING:
|
|
|
28
28
|
|
|
29
29
|
def test_version_is_exposed() -> None:
|
|
30
30
|
"""Package exposes its current version."""
|
|
31
|
-
assert worklogs.__version__ == "0.3.
|
|
31
|
+
assert worklogs.__version__ == "0.3.3"
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def test_cli_accepts_no_arguments() -> None:
|
|
@@ -57,7 +57,7 @@ def test_parse_identity_token_rejects_unknown_kind() -> None:
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def test_entry_path_format(tmp_path: Path) -> None:
|
|
60
|
-
"""Path uses HHMM--name--kind.md format."""
|
|
60
|
+
"""Path uses HHMM-Hp/a--name--kind.md format with human-readable dirs."""
|
|
61
61
|
tz = ZoneInfo("America/Toronto")
|
|
62
62
|
config = WorklogConfig(
|
|
63
63
|
root=tmp_path / "worklog",
|
|
@@ -78,9 +78,9 @@ def test_entry_path_format(tmp_path: Path) -> None:
|
|
|
78
78
|
/ "worklog"
|
|
79
79
|
/ "work"
|
|
80
80
|
/ "2026"
|
|
81
|
-
/ "06"
|
|
82
|
-
/ "12"
|
|
83
|
-
/ "1421--leansim2sim--plan.md"
|
|
81
|
+
/ "06-june"
|
|
82
|
+
/ "12-friday"
|
|
83
|
+
/ "1421-2p--leansim2sim--plan.md"
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
|
|
@@ -106,8 +106,8 @@ def test_plan_creates_companion_with_same_name(tmp_path: Path) -> None:
|
|
|
106
106
|
)
|
|
107
107
|
|
|
108
108
|
assert len(entries) == 2
|
|
109
|
-
assert entries[0].path.name == "1421--leansim2sim--plan.md"
|
|
110
|
-
assert entries[1].path.name == "1421--leansim2sim--note.md"
|
|
109
|
+
assert entries[0].path.name == "1421-2p--leansim2sim--plan.md"
|
|
110
|
+
assert entries[1].path.name == "1421-2p--leansim2sim--note.md"
|
|
111
111
|
assert "leansim2sim--note.md" in entries[0].content
|
|
112
112
|
assert "leansim2sim--plan.md" in entries[1].content
|
|
113
113
|
|
|
@@ -134,7 +134,7 @@ def test_note_creates_single_file(tmp_path: Path) -> None:
|
|
|
134
134
|
)
|
|
135
135
|
|
|
136
136
|
assert len(entries) == 1
|
|
137
|
-
assert entries[0].path.name == "1000--quick-observation--note.md"
|
|
137
|
+
assert entries[0].path.name == "1000-10a--quick-observation--note.md"
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
def test_new_creates_new_format_files(
|
|
@@ -149,7 +149,7 @@ def test_new_creates_new_format_files(
|
|
|
149
149
|
|
|
150
150
|
created = sorted((root / "work").glob("*/*/*/*.md"))
|
|
151
151
|
assert len(created) == 2
|
|
152
|
-
names = {p.name[
|
|
152
|
+
names = {p.name.split("--", 1)[1] for p in created} # strip HHMM-Hp/a-- prefix
|
|
153
153
|
assert names == {"leansim2sim--plan.md", "leansim2sim--note.md"}
|
|
154
154
|
|
|
155
155
|
|
|
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
|