simple-project-tracker 1.2.1__tar.gz → 1.3.0__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.
- {simple_project_tracker-1.2.1/simple_project_tracker.egg-info → simple_project_tracker-1.3.0}/PKG-INFO +9 -1
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/README.md +8 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/pyproject.toml +1 -1
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0/simple_project_tracker.egg-info}/PKG-INFO +9 -1
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/SOURCES.txt +2 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_todos.py +14 -0
- simple_project_tracker-1.3.0/tests/test_tui.py +147 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/cli/app.py +5 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/config/defaults.py +1 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/share/help.txt +2 -1
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/share/settings.toml +4 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/mentions.py +19 -2
- simple_project_tracker-1.3.0/tracker/ui/tui.py +887 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/LICENSE +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/setup.cfg +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/dependency_links.txt +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/entry_points.txt +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/top_level.txt +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_cli.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_commands.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_daemon.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_details.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_doctor.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_frecency.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_help.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_identity.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_keys.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_labels.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_moves.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_names.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_paths.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_portable.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_relocate.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_render.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_selection.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_settings.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_storage.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_undo.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tests/test_view.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/__init__.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/__main__.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/cli/__init__.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/cli/commands.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/cli/doctor.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/cli/entries.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/cli/relocate.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/cli/todo.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/config/__init__.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/config/keys.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/config/metadata.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/config/paths.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/config/settings.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/config/writer.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/__init__.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/daemon.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/discovery.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/entries.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/frecency.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/identity.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/inspect.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/labels.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/models.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/portable.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/selection.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/storage.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/todos.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/undo.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/core/view.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/py.typed +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/share/completion.bash +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/share/completion.fish +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/share/completion.zsh +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/__init__.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/ansi.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/ask.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/details.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/help.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/render.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/ui/todos.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/util/__init__.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/util/compat.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/util/files.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/util/text.py +0 -0
- {simple_project_tracker-1.2.1 → simple_project_tracker-1.3.0}/tracker/util/unknown.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simple-project-tracker
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Simple project tracker
|
|
5
5
|
Author-email: MattFor <mattfor@relaxy.xyz>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -70,6 +70,13 @@ Python 3.11+. Then `t init ~/(your project directory)` to fill the database.
|
|
|
70
70
|
|
|
71
71
|
## Commands
|
|
72
72
|
|
|
73
|
+
`t` on its own lists your projects. With `output.browser` on it opens a browser instead: your
|
|
74
|
+
monitored folders as a tree, each project's status and last change, and the `check` view of
|
|
75
|
+
the selected one beside it. Arrows move and fold, enter opens the details, `?` lists every
|
|
76
|
+
key: search, every project instead of the filtered ones, a flat list, the full tree, sorting,
|
|
77
|
+
one status at a time. Tab switches to your todos and the projects each one is about. `q`
|
|
78
|
+
quits. Piped, or with `t list`, it prints the table instead.
|
|
79
|
+
|
|
73
80
|
| Command | Aliases | What it does |
|
|
74
81
|
| ------------ | ------------------- | -------------------------------------------------------------------- |
|
|
75
82
|
| `list` | `l`, `ls` | List projects, with search, regex, filters and setting overrides |
|
|
@@ -223,6 +230,7 @@ or by its initials, with the section shortening the same way: `display.list_limi
|
|
|
223
230
|
| `todos.new_status`, `.done_status` | What a new todo is called, and what `done` and `clear` use |
|
|
224
231
|
| `todos.sort`, `todos.newest_first` | How the todo list is ordered |
|
|
225
232
|
| `[todos.display]` | Display settings the todo list alone uses |
|
|
233
|
+
| `output.browser` | A bare `t` opens the project browser instead of the list |
|
|
226
234
|
|
|
227
235
|
Notes can colour themselves: `t note 12 {red}broken{/} since friday`.
|
|
228
236
|
|
|
@@ -38,6 +38,13 @@ Python 3.11+. Then `t init ~/(your project directory)` to fill the database.
|
|
|
38
38
|
|
|
39
39
|
## Commands
|
|
40
40
|
|
|
41
|
+
`t` on its own lists your projects. With `output.browser` on it opens a browser instead: your
|
|
42
|
+
monitored folders as a tree, each project's status and last change, and the `check` view of
|
|
43
|
+
the selected one beside it. Arrows move and fold, enter opens the details, `?` lists every
|
|
44
|
+
key: search, every project instead of the filtered ones, a flat list, the full tree, sorting,
|
|
45
|
+
one status at a time. Tab switches to your todos and the projects each one is about. `q`
|
|
46
|
+
quits. Piped, or with `t list`, it prints the table instead.
|
|
47
|
+
|
|
41
48
|
| Command | Aliases | What it does |
|
|
42
49
|
| ------------ | ------------------- | -------------------------------------------------------------------- |
|
|
43
50
|
| `list` | `l`, `ls` | List projects, with search, regex, filters and setting overrides |
|
|
@@ -191,6 +198,7 @@ or by its initials, with the section shortening the same way: `display.list_limi
|
|
|
191
198
|
| `todos.new_status`, `.done_status` | What a new todo is called, and what `done` and `clear` use |
|
|
192
199
|
| `todos.sort`, `todos.newest_first` | How the todo list is ordered |
|
|
193
200
|
| `[todos.display]` | Display settings the todo list alone uses |
|
|
201
|
+
| `output.browser` | A bare `t` opens the project browser instead of the list |
|
|
194
202
|
|
|
195
203
|
Notes can colour themselves: `t note 12 {red}broken{/} since friday`.
|
|
196
204
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simple-project-tracker
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Simple project tracker
|
|
5
5
|
Author-email: MattFor <mattfor@relaxy.xyz>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -70,6 +70,13 @@ Python 3.11+. Then `t init ~/(your project directory)` to fill the database.
|
|
|
70
70
|
|
|
71
71
|
## Commands
|
|
72
72
|
|
|
73
|
+
`t` on its own lists your projects. With `output.browser` on it opens a browser instead: your
|
|
74
|
+
monitored folders as a tree, each project's status and last change, and the `check` view of
|
|
75
|
+
the selected one beside it. Arrows move and fold, enter opens the details, `?` lists every
|
|
76
|
+
key: search, every project instead of the filtered ones, a flat list, the full tree, sorting,
|
|
77
|
+
one status at a time. Tab switches to your todos and the projects each one is about. `q`
|
|
78
|
+
quits. Piped, or with `t list`, it prints the table instead.
|
|
79
|
+
|
|
73
80
|
| Command | Aliases | What it does |
|
|
74
81
|
| ------------ | ------------------- | -------------------------------------------------------------------- |
|
|
75
82
|
| `list` | `l`, `ls` | List projects, with search, regex, filters and setting overrides |
|
|
@@ -223,6 +230,7 @@ or by its initials, with the section shortening the same way: `display.list_limi
|
|
|
223
230
|
| `todos.new_status`, `.done_status` | What a new todo is called, and what `done` and `clear` use |
|
|
224
231
|
| `todos.sort`, `todos.newest_first` | How the todo list is ordered |
|
|
225
232
|
| `[todos.display]` | Display settings the todo list alone uses |
|
|
233
|
+
| `output.browser` | A bare `t` opens the project browser instead of the list |
|
|
226
234
|
|
|
227
235
|
Notes can colour themselves: `t note 12 {red}broken{/} since friday`.
|
|
228
236
|
|
|
@@ -26,6 +26,7 @@ tests/test_selection.py
|
|
|
26
26
|
tests/test_settings.py
|
|
27
27
|
tests/test_storage.py
|
|
28
28
|
tests/test_todos.py
|
|
29
|
+
tests/test_tui.py
|
|
29
30
|
tests/test_undo.py
|
|
30
31
|
tests/test_view.py
|
|
31
32
|
tracker/__init__.py
|
|
@@ -73,6 +74,7 @@ tracker/ui/help.py
|
|
|
73
74
|
tracker/ui/mentions.py
|
|
74
75
|
tracker/ui/render.py
|
|
75
76
|
tracker/ui/todos.py
|
|
77
|
+
tracker/ui/tui.py
|
|
76
78
|
tracker/util/__init__.py
|
|
77
79
|
tracker/util/compat.py
|
|
78
80
|
tracker/util/files.py
|
|
@@ -772,6 +772,20 @@ def test_a_todo_check_names_the_projects_it_is_about(tmp_path: Path):
|
|
|
772
772
|
assert "beta" not in shown
|
|
773
773
|
|
|
774
774
|
|
|
775
|
+
def test_a_todo_named_after_a_project_is_about_it():
|
|
776
|
+
from tests.helpers import SAMPLE, make_projects
|
|
777
|
+
from tracker.core.todos import new_todo
|
|
778
|
+
from tracker.ui.mentions import about
|
|
779
|
+
|
|
780
|
+
projects = make_projects(*SAMPLE)
|
|
781
|
+
|
|
782
|
+
todo = new_todo("Alpha", status="todo", note="then @gamma", todo_id=1)
|
|
783
|
+
loose = new_todo("alp", status="todo", todo_id=2)
|
|
784
|
+
|
|
785
|
+
assert [Path(path).name for path in about(todo, projects)] == ["alpha", "gamma"]
|
|
786
|
+
assert about(loose, projects) == []
|
|
787
|
+
|
|
788
|
+
|
|
775
789
|
def test_a_todo_that_names_nothing_keeps_the_check_quiet(tmp_path: Path):
|
|
776
790
|
from tests.helpers import SAMPLE, make_projects
|
|
777
791
|
from tracker.ui import mentions
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from tests.helpers import SAMPLE, make_projects, make_settings
|
|
6
|
+
from tracker.core.models import Project
|
|
7
|
+
from tracker.core.todos import new_todo
|
|
8
|
+
from tracker.ui import mentions
|
|
9
|
+
|
|
10
|
+
from tracker.util.text import strip_ansi
|
|
11
|
+
from tracker.ui.tui import (
|
|
12
|
+
ELSEWHERE,
|
|
13
|
+
Browser,
|
|
14
|
+
Node,
|
|
15
|
+
Row,
|
|
16
|
+
build_tree,
|
|
17
|
+
cycle,
|
|
18
|
+
flatten,
|
|
19
|
+
pick,
|
|
20
|
+
pick_todos,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
WHEN = "2026-01-01 10:00:00"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def tree(*entries: tuple[str, str]):
|
|
27
|
+
projects = make_projects(*((path, status, WHEN, "") for path, status in entries))
|
|
28
|
+
|
|
29
|
+
return build_tree(list(projects.items()), ["/work"])
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def labels(rows: list[Row]) -> list[str]:
|
|
33
|
+
return [" " * depth + node.name for depth, node in rows]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_projects_hang_under_their_folders_and_strays_go_elsewhere():
|
|
37
|
+
nodes = tree(
|
|
38
|
+
("/work/projects/python/tracker", "dev"),
|
|
39
|
+
("/work/projects/c++/hprint", "done"),
|
|
40
|
+
("/work/personal/mood", "unknown"),
|
|
41
|
+
("/tmp/scratch", "dev"),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
assert labels(flatten(nodes, set())) == [
|
|
45
|
+
"/work",
|
|
46
|
+
" personal",
|
|
47
|
+
" mood",
|
|
48
|
+
" projects",
|
|
49
|
+
" c++",
|
|
50
|
+
" hprint",
|
|
51
|
+
" python",
|
|
52
|
+
" tracker",
|
|
53
|
+
ELSEWHERE,
|
|
54
|
+
" /tmp/scratch",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_a_collapsed_folder_hides_its_projects_but_keeps_counting_them():
|
|
59
|
+
nodes = tree(
|
|
60
|
+
("/work/projects/python/tracker", "dev"),
|
|
61
|
+
("/work/projects/c++/hprint", "done"),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
rows = flatten(nodes, {"/work/projects"})
|
|
65
|
+
|
|
66
|
+
assert labels(rows) == ["/work", " projects"]
|
|
67
|
+
assert rows[1][1].count() == 2
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_a_project_holding_projects_is_a_folder_with_a_status():
|
|
71
|
+
nodes = tree(("/work/abba", "dev"), ("/work/abba/lib/inicpp", "unknown"))
|
|
72
|
+
|
|
73
|
+
abba = flatten(nodes, set())[1][1]
|
|
74
|
+
|
|
75
|
+
assert abba.name == "abba"
|
|
76
|
+
assert abba.project is not None and abba.project["status"] == "dev"
|
|
77
|
+
assert abba.count() == 2
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def names(items: list[tuple[str, Project]]) -> list[str]:
|
|
81
|
+
return [path.rsplit("/", 1)[1] for path, _ in items]
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_pick_hides_what_the_display_filter_hides_unless_asked_for_everything():
|
|
85
|
+
projects = make_projects(*SAMPLE)
|
|
86
|
+
settings = make_settings(display__filter=["-s:archived"])
|
|
87
|
+
|
|
88
|
+
assert "beta" not in names(pick(projects, settings, sort="name"))
|
|
89
|
+
assert names(pick(projects, settings, every=True, sort="name")) == [
|
|
90
|
+
"alpha",
|
|
91
|
+
"beta",
|
|
92
|
+
"gamma",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_pick_narrows_by_status_and_by_search_over_paths_and_notes():
|
|
97
|
+
projects = make_projects(*SAMPLE)
|
|
98
|
+
settings = make_settings()
|
|
99
|
+
|
|
100
|
+
assert names(pick(projects, settings, status="todo")) == ["gamma"]
|
|
101
|
+
assert names(pick(projects, settings, query="SHORT")) == ["alpha"]
|
|
102
|
+
assert names(pick(projects, settings, query="gam")) == ["gamma"]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def test_pick_sorts_the_newest_first_when_sorting_by_last_touched():
|
|
106
|
+
projects = make_projects(*SAMPLE)
|
|
107
|
+
|
|
108
|
+
picked = pick(projects, make_settings(), sort="last_touched")
|
|
109
|
+
|
|
110
|
+
assert names(picked) == ["beta", "alpha", "gamma"]
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def test_pick_todos_narrows_by_status_and_search_and_follows_the_sort():
|
|
114
|
+
todos = {
|
|
115
|
+
"1": new_todo("tracker", status="todo", note="the tui @tracker", todo_id=1),
|
|
116
|
+
"2": new_todo("lexiglance", status="done", note="respond to the PR", todo_id=2),
|
|
117
|
+
}
|
|
118
|
+
settings = make_settings()
|
|
119
|
+
|
|
120
|
+
assert [key for key, _ in pick_todos(todos, settings)] == ["1", "2"]
|
|
121
|
+
assert [key for key, _ in pick_todos(todos, settings, sort="name")] == ["2", "1"]
|
|
122
|
+
assert [key for key, _ in pick_todos(todos, settings, status="done")] == ["2"]
|
|
123
|
+
assert [key for key, _ in pick_todos(todos, settings, query="TUI")] == ["1"]
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def test_a_todo_named_after_a_project_shows_that_project_under_it(
|
|
127
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
128
|
+
):
|
|
129
|
+
monkeypatch.setenv("TRACKER_TODOS", str(tmp_path / "todos.pkl"))
|
|
130
|
+
projects = make_projects(*SAMPLE)
|
|
131
|
+
mentions.use(projects)
|
|
132
|
+
browser = Browser(projects, make_settings())
|
|
133
|
+
|
|
134
|
+
def shown(name: str) -> str:
|
|
135
|
+
todo = new_todo(name, status="todo", note="ship it", todo_id=1)
|
|
136
|
+
|
|
137
|
+
return strip_ansi("\n".join(browser.describe(Node(name, "1", todo=todo))))
|
|
138
|
+
|
|
139
|
+
assert "short note" in shown("alpha")
|
|
140
|
+
assert "short note" not in shown("alp")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_cycle_walks_the_options_and_back_to_none():
|
|
144
|
+
assert cycle(["a", "b"], None) == "a"
|
|
145
|
+
assert cycle(["a", "b"], "a") == "b"
|
|
146
|
+
assert cycle(["a", "b"], "b") is None
|
|
147
|
+
assert cycle(["a", "b"], "gone") is None
|
|
@@ -393,6 +393,11 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
393
393
|
context.log(f"projects: {len(context.data)}")
|
|
394
394
|
|
|
395
395
|
if not args:
|
|
396
|
+
if settings["output"]["browser"] and sys.stdin.isatty() and sys.stdout.isatty():
|
|
397
|
+
from tracker.ui.tui import run
|
|
398
|
+
|
|
399
|
+
return run(context.data, settings)
|
|
400
|
+
|
|
396
401
|
print_projects(context.data, settings)
|
|
397
402
|
return 0
|
|
398
403
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
{GREEN}tracker <command> [arguments] [options]{RESET}
|
|
5
5
|
{GREEN}tracker <project> <command> [arguments] [options]{RESET}
|
|
6
6
|
|
|
7
|
-
{GRAY}No arguments prints the tracked projects.{RESET}
|
|
7
|
+
{GRAY}No arguments prints the tracked projects. With {GREEN}output.browser{GRAY} on it opens the{RESET}
|
|
8
|
+
{GRAY}project browser in a terminal instead. {GREEN}tracker list{GRAY} always prints them.{RESET}
|
|
8
9
|
{GRAY}Commands that work on a project accept it before or after the command.{RESET}
|
|
9
10
|
|
|
10
11
|
{BOLD}Commands:{RESET}
|
|
@@ -166,10 +166,27 @@ def points_at(text: str, projects: Projects) -> list[str]:
|
|
|
166
166
|
return paths
|
|
167
167
|
|
|
168
168
|
|
|
169
|
+
def named_after(todo: Todo, projects: Projects) -> str | None:
|
|
170
|
+
name = str(todo.get("name", "")).strip().lower()
|
|
171
|
+
named = [path for path in projects if Path(path).name.lower() == name]
|
|
172
|
+
|
|
173
|
+
return named[0] if len(named) == 1 else None
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def about(todo: Todo, projects: Projects) -> list[str]:
|
|
177
|
+
paths = points_at(_wording(todo), projects)
|
|
178
|
+
named = named_after(todo, projects)
|
|
179
|
+
|
|
180
|
+
if named is not None and named not in paths:
|
|
181
|
+
paths.insert(0, named)
|
|
182
|
+
|
|
183
|
+
return paths
|
|
184
|
+
|
|
185
|
+
|
|
169
186
|
def projects_of(todo: Todo, settings: Settings) -> list[tuple[str, Project]]:
|
|
170
187
|
projects = _projects(settings)
|
|
171
188
|
|
|
172
|
-
return [(path, projects[path]) for path in
|
|
189
|
+
return [(path, projects[path]) for path in about(todo, projects)]
|
|
173
190
|
|
|
174
191
|
|
|
175
192
|
def todos_about(path: str, settings: Settings) -> Todos:
|
|
@@ -182,7 +199,7 @@ def todos_about(path: str, settings: Settings) -> Todos:
|
|
|
182
199
|
return {
|
|
183
200
|
key: todo
|
|
184
201
|
for key, todo in _todos(settings).items()
|
|
185
|
-
if path in
|
|
202
|
+
if path in about(todo, projects)
|
|
186
203
|
}
|
|
187
204
|
|
|
188
205
|
|