simple-project-tracker 1.2.0__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.0/simple_project_tracker.egg-info → simple_project_tracker-1.3.0}/PKG-INFO +11 -1
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/README.md +10 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/pyproject.toml +1 -1
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0/simple_project_tracker.egg-info}/PKG-INFO +11 -1
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/SOURCES.txt +2 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_todos.py +56 -0
- simple_project_tracker-1.3.0/tests/test_tui.py +147 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/cli/app.py +5 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/cli/entries.py +5 -5
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/cli/todo.py +69 -7
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/config/defaults.py +1 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/share/help.txt +6 -2
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/share/settings.toml +4 -0
- {simple_project_tracker-1.2.0 → 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.0 → simple_project_tracker-1.3.0}/LICENSE +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/setup.cfg +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/dependency_links.txt +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/entry_points.txt +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/simple_project_tracker.egg-info/top_level.txt +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_cli.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_commands.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_daemon.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_details.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_doctor.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_frecency.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_help.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_identity.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_keys.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_labels.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_moves.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_names.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_paths.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_portable.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_relocate.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_render.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_selection.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_settings.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_storage.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_undo.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tests/test_view.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/__init__.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/__main__.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/cli/__init__.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/cli/commands.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/cli/doctor.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/cli/relocate.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/config/__init__.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/config/keys.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/config/metadata.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/config/paths.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/config/settings.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/config/writer.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/__init__.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/daemon.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/discovery.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/entries.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/frecency.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/identity.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/inspect.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/labels.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/models.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/portable.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/selection.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/storage.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/todos.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/undo.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/core/view.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/py.typed +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/share/completion.bash +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/share/completion.fish +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/share/completion.zsh +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/ui/__init__.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/ui/ansi.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/ui/ask.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/ui/details.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/ui/help.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/ui/render.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/ui/todos.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/util/__init__.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/util/compat.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/util/files.py +0 -0
- {simple_project_tracker-1.2.0 → simple_project_tracker-1.3.0}/tracker/util/text.py +0 -0
- {simple_project_tracker-1.2.0 → 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 |
|
|
@@ -120,9 +127,11 @@ List of notes that's separate from the main project database.
|
|
|
120
127
|
```sh
|
|
121
128
|
t td # the whole list
|
|
122
129
|
t td add write the changelog # the rest of the line is the name
|
|
130
|
+
t td add milk s shop n oat # with a status and a note up front
|
|
123
131
|
t td 3 done # also: t td done 3
|
|
124
132
|
t td 3 st blocked # any status you like
|
|
125
133
|
t td 3 n waiting on review # and a note under it
|
|
134
|
+
t td write the docs n today # by name; offers to add one that is not there
|
|
126
135
|
t td list s:todo # only what is still open
|
|
127
136
|
t td clear # drop every finished one
|
|
128
137
|
t td undo # take the last change back
|
|
@@ -221,6 +230,7 @@ or by its initials, with the section shortening the same way: `display.list_limi
|
|
|
221
230
|
| `todos.new_status`, `.done_status` | What a new todo is called, and what `done` and `clear` use |
|
|
222
231
|
| `todos.sort`, `todos.newest_first` | How the todo list is ordered |
|
|
223
232
|
| `[todos.display]` | Display settings the todo list alone uses |
|
|
233
|
+
| `output.browser` | A bare `t` opens the project browser instead of the list |
|
|
224
234
|
|
|
225
235
|
Notes can colour themselves: `t note 12 {red}broken{/} since friday`.
|
|
226
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 |
|
|
@@ -88,9 +95,11 @@ List of notes that's separate from the main project database.
|
|
|
88
95
|
```sh
|
|
89
96
|
t td # the whole list
|
|
90
97
|
t td add write the changelog # the rest of the line is the name
|
|
98
|
+
t td add milk s shop n oat # with a status and a note up front
|
|
91
99
|
t td 3 done # also: t td done 3
|
|
92
100
|
t td 3 st blocked # any status you like
|
|
93
101
|
t td 3 n waiting on review # and a note under it
|
|
102
|
+
t td write the docs n today # by name; offers to add one that is not there
|
|
94
103
|
t td list s:todo # only what is still open
|
|
95
104
|
t td clear # drop every finished one
|
|
96
105
|
t td undo # take the last change back
|
|
@@ -189,6 +198,7 @@ or by its initials, with the section shortening the same way: `display.list_limi
|
|
|
189
198
|
| `todos.new_status`, `.done_status` | What a new todo is called, and what `done` and `clear` use |
|
|
190
199
|
| `todos.sort`, `todos.newest_first` | How the todo list is ordered |
|
|
191
200
|
| `[todos.display]` | Display settings the todo list alone uses |
|
|
201
|
+
| `output.browser` | A bare `t` opens the project browser instead of the list |
|
|
192
202
|
|
|
193
203
|
Notes can colour themselves: `t note 12 {red}broken{/} since friday`.
|
|
194
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 |
|
|
@@ -120,9 +127,11 @@ List of notes that's separate from the main project database.
|
|
|
120
127
|
```sh
|
|
121
128
|
t td # the whole list
|
|
122
129
|
t td add write the changelog # the rest of the line is the name
|
|
130
|
+
t td add milk s shop n oat # with a status and a note up front
|
|
123
131
|
t td 3 done # also: t td done 3
|
|
124
132
|
t td 3 st blocked # any status you like
|
|
125
133
|
t td 3 n waiting on review # and a note under it
|
|
134
|
+
t td write the docs n today # by name; offers to add one that is not there
|
|
126
135
|
t td list s:todo # only what is still open
|
|
127
136
|
t td clear # drop every finished one
|
|
128
137
|
t td undo # take the last change back
|
|
@@ -221,6 +230,7 @@ or by its initials, with the section shortening the same way: `display.list_limi
|
|
|
221
230
|
| `todos.new_status`, `.done_status` | What a new todo is called, and what `done` and `clear` use |
|
|
222
231
|
| `todos.sort`, `todos.newest_first` | How the todo list is ordered |
|
|
223
232
|
| `[todos.display]` | Display settings the todo list alone uses |
|
|
233
|
+
| `output.browser` | A bare `t` opens the project browser instead of the list |
|
|
224
234
|
|
|
225
235
|
Notes can colour themselves: `t note 12 {red}broken{/} since friday`.
|
|
226
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
|
|
@@ -150,6 +150,48 @@ def test_a_todo_may_come_before_its_action(tmp_path: Path):
|
|
|
150
150
|
assert status_of(load_todos(holder.settings)["1"]) == "blocked"
|
|
151
151
|
|
|
152
152
|
|
|
153
|
+
def test_every_word_before_the_action_is_the_todo(tmp_path: Path):
|
|
154
|
+
holder = context(tmp_path)
|
|
155
|
+
|
|
156
|
+
_ = run(holder, "add", "read the manual")
|
|
157
|
+
_ = run(holder, "add", "write the docs")
|
|
158
|
+
|
|
159
|
+
output = run(holder, "write", "the", "docs", "n", "before", "friday")
|
|
160
|
+
|
|
161
|
+
assert "note did nothing" not in output
|
|
162
|
+
assert load_todos(holder.settings)["2"].get("note") == "before friday"
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def test_a_todo_is_added_with_its_note_and_status(tmp_path: Path):
|
|
166
|
+
holder = context(tmp_path)
|
|
167
|
+
|
|
168
|
+
_ = run(holder, "add", "buy", "milk", "s", "blocked", "n", "oat", "not", "dairy")
|
|
169
|
+
|
|
170
|
+
todo = load_todos(holder.settings)["1"]
|
|
171
|
+
|
|
172
|
+
assert todo["name"] == "buy milk"
|
|
173
|
+
assert status_of(todo) == "blocked"
|
|
174
|
+
assert todo.get("note") == "oat not dairy"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def test_a_note_for_a_missing_todo_adds_it(tmp_path: Path):
|
|
178
|
+
holder = context(tmp_path)
|
|
179
|
+
|
|
180
|
+
_ = run(holder, "add", "read the manual")
|
|
181
|
+
_ = run(holder, "lexiglance", "n", "respond", "to", "the", "pr")
|
|
182
|
+
|
|
183
|
+
todo = load_todos(holder.settings)["2"]
|
|
184
|
+
|
|
185
|
+
assert todo["name"] == "lexiglance"
|
|
186
|
+
assert todo.get("note") == "respond to the pr"
|
|
187
|
+
|
|
188
|
+
_ = run(holder, "9", "n", "nothing")
|
|
189
|
+
_ = run(holder, "manual", "n", "just the note")
|
|
190
|
+
|
|
191
|
+
assert len(load_todos(holder.settings)) == 2
|
|
192
|
+
assert load_todos(holder.settings)["1"].get("note") == "just the note"
|
|
193
|
+
|
|
194
|
+
|
|
153
195
|
def test_a_bare_note_clears_it(tmp_path: Path):
|
|
154
196
|
holder = context(tmp_path)
|
|
155
197
|
|
|
@@ -730,6 +772,20 @@ def test_a_todo_check_names_the_projects_it_is_about(tmp_path: Path):
|
|
|
730
772
|
assert "beta" not in shown
|
|
731
773
|
|
|
732
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
|
+
|
|
733
789
|
def test_a_todo_that_names_nothing_keeps_the_check_quiet(tmp_path: Path):
|
|
734
790
|
from tests.helpers import SAMPLE, make_projects
|
|
735
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
|
|
|
@@ -424,16 +424,16 @@ class Kind:
|
|
|
424
424
|
|
|
425
425
|
return wanted
|
|
426
426
|
|
|
427
|
-
def edit(self, context: Context, args: list[str]) -> int:
|
|
427
|
+
def edit(self, context: Context, args: list[str], command: str = "edit") -> int:
|
|
428
428
|
if not args:
|
|
429
|
-
return self.missing(
|
|
429
|
+
return self.missing(command)
|
|
430
430
|
|
|
431
431
|
if len(args) < 2:
|
|
432
432
|
print(f"[ERROR] edit requires a field: {', '.join(self.editable)}")
|
|
433
433
|
return 1
|
|
434
434
|
|
|
435
435
|
entries = self.load(context)
|
|
436
|
-
selected = self.chosen(context, entries, [args[0]],
|
|
436
|
+
selected = self.chosen(context, entries, [args[0]], command)
|
|
437
437
|
|
|
438
438
|
if selected is None:
|
|
439
439
|
return 1
|
|
@@ -514,13 +514,13 @@ class Kind:
|
|
|
514
514
|
return self.missing(name)
|
|
515
515
|
|
|
516
516
|
if name in self.greedy:
|
|
517
|
-
return self.edit(context, [args[0], name, *args[1:]])
|
|
517
|
+
return self.edit(context, [args[0], name, *args[1:]], name)
|
|
518
518
|
|
|
519
519
|
if len(args) < 2:
|
|
520
520
|
print(f"[ERROR] {name} requires a value")
|
|
521
521
|
return 1
|
|
522
522
|
|
|
523
|
-
return self.edit(context, [args[0], name, " ".join(args[1:])])
|
|
523
|
+
return self.edit(context, [args[0], name, " ".join(args[1:])], name)
|
|
524
524
|
|
|
525
525
|
def statuses(self, context: Context) -> int:
|
|
526
526
|
settings = context.settings
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
from typing import Any, final
|
|
2
3
|
|
|
3
4
|
from tracker.cli.entries import (
|
|
@@ -31,6 +32,7 @@ from tracker.core.todos import (
|
|
|
31
32
|
)
|
|
32
33
|
from tracker.ui import mentions
|
|
33
34
|
from tracker.ui.ansi import C
|
|
35
|
+
from tracker.ui.ask import confirm as ask
|
|
34
36
|
from tracker.ui.help import print_topic
|
|
35
37
|
from tracker.ui.todos import (
|
|
36
38
|
note_text,
|
|
@@ -95,6 +97,9 @@ TAKES_SELECTION = frozenset(
|
|
|
95
97
|
{"check", "done", "edit", "note", "remove", "rename", "reopen", "status"}
|
|
96
98
|
)
|
|
97
99
|
|
|
100
|
+
# The words that end a new todo's name and start its fields, as in add milk n oat
|
|
101
|
+
ADD_FIELDS = frozenset({"n", "nt", "s", "st"})
|
|
102
|
+
|
|
98
103
|
|
|
99
104
|
def action_of(token: str) -> str:
|
|
100
105
|
return ALIASES.get(token.lower().strip("-"), "")
|
|
@@ -209,14 +214,28 @@ def action_list(context: Context, args: list[str]) -> int:
|
|
|
209
214
|
|
|
210
215
|
|
|
211
216
|
def action_add(context: Context, args: list[str]) -> int:
|
|
212
|
-
|
|
217
|
+
at = next(
|
|
218
|
+
(
|
|
219
|
+
index
|
|
220
|
+
for index, token in enumerate(args)
|
|
221
|
+
if token.lower().strip("-") in ADD_FIELDS
|
|
222
|
+
),
|
|
223
|
+
len(args),
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
name = " ".join(args[:at]).strip()
|
|
213
227
|
|
|
214
228
|
if not name:
|
|
215
229
|
print("[ERROR] add requires something to do")
|
|
216
|
-
print(f"{C.GRAY} t td add read the manual{C.RESET}")
|
|
230
|
+
print(f"{C.GRAY} t td add read the manual n before friday{C.RESET}")
|
|
217
231
|
|
|
218
232
|
return 1
|
|
219
233
|
|
|
234
|
+
wanted = TODO.fields_from(args[at:])
|
|
235
|
+
|
|
236
|
+
if wanted is None:
|
|
237
|
+
return 1
|
|
238
|
+
|
|
220
239
|
settings = context.settings
|
|
221
240
|
todos = TODO.load(context)
|
|
222
241
|
|
|
@@ -227,6 +246,9 @@ def action_add(context: Context, args: list[str]) -> int:
|
|
|
227
246
|
created=stamp(settings),
|
|
228
247
|
)
|
|
229
248
|
|
|
249
|
+
for field, value in wanted:
|
|
250
|
+
TODO.set(context, todo, field, value)
|
|
251
|
+
|
|
230
252
|
key = key_of(todo)
|
|
231
253
|
todos[key] = todo
|
|
232
254
|
|
|
@@ -325,6 +347,27 @@ def action_undo(context: Context) -> int:
|
|
|
325
347
|
return 0
|
|
326
348
|
|
|
327
349
|
|
|
350
|
+
def offer_new(context: Context, name: str) -> bool:
|
|
351
|
+
"""A note or status for a todo that is not there yet may be meant to add it."""
|
|
352
|
+
|
|
353
|
+
# A number, a range or a selector (#3, :2, s:todo, all) names one that should exist
|
|
354
|
+
if (
|
|
355
|
+
name.lower() in ALL_SELECTORS
|
|
356
|
+
or not any(letter.isalpha() for letter in name)
|
|
357
|
+
or any(mark in name for mark in ":=")
|
|
358
|
+
):
|
|
359
|
+
return False
|
|
360
|
+
|
|
361
|
+
# The same test a name selector makes, so a todo it would find is never doubled
|
|
362
|
+
if any(name.lower() in todo["name"].lower() for todo in TODO.load(context).values()):
|
|
363
|
+
return False
|
|
364
|
+
|
|
365
|
+
if not (context.assume_yes or sys.stdin.isatty()):
|
|
366
|
+
return False
|
|
367
|
+
|
|
368
|
+
return ask(f"no todo matches '{name}', add it?", assume_yes=context.assume_yes)
|
|
369
|
+
|
|
370
|
+
|
|
328
371
|
#
|
|
329
372
|
# The command
|
|
330
373
|
#
|
|
@@ -337,12 +380,31 @@ def command_todo(context: Context, args: list[str]) -> int:
|
|
|
337
380
|
action = action_of(args[0]) if args else "list"
|
|
338
381
|
arguments = args[1:]
|
|
339
382
|
|
|
340
|
-
# A td may come before its action
|
|
341
|
-
if not action
|
|
342
|
-
|
|
383
|
+
# A td may come before its action, and every word up to it is its name
|
|
384
|
+
if not action:
|
|
385
|
+
at = next(
|
|
386
|
+
(
|
|
387
|
+
index
|
|
388
|
+
for index, token in enumerate(args)
|
|
389
|
+
if action_of(token) in TAKES_SELECTION
|
|
390
|
+
),
|
|
391
|
+
0,
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
if at:
|
|
395
|
+
action, arguments = (
|
|
396
|
+
action_of(args[at]),
|
|
397
|
+
[" ".join(args[:at]), *args[at + 1 :]],
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
if (
|
|
401
|
+
action in ("note", "status")
|
|
402
|
+
and len(arguments) > 1
|
|
403
|
+
and offer_new(context, arguments[0])
|
|
404
|
+
):
|
|
405
|
+
mark = "n" if action == "note" else "s"
|
|
343
406
|
|
|
344
|
-
|
|
345
|
-
action, arguments = following, [args[0], *args[2:]]
|
|
407
|
+
return action_add(context, [arguments[0], mark, *arguments[1:]])
|
|
346
408
|
|
|
347
409
|
context.log(f"todos: {len(TODO.load(context))}")
|
|
348
410
|
|
|
@@ -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}
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
|
|
155
156
|
{GRAY}Usage:{RESET}
|
|
156
157
|
{GREEN}tracker todo{RESET}
|
|
157
|
-
{GREEN}tracker todo add <what to do...>{RESET}
|
|
158
|
+
{GREEN}tracker todo add <what to do...> [s <status>] [n <note...>]{RESET}
|
|
158
159
|
{GREEN}tracker todo done <selection>{RESET}
|
|
159
160
|
{GREEN}tracker todo reopen <selection>{RESET}
|
|
160
161
|
{GREEN}tracker todo status <selection> <value>{RESET}
|
|
@@ -470,6 +471,7 @@
|
|
|
470
471
|
|
|
471
472
|
{GREEN}t td{RESET} {GRAY}every todo{RESET}
|
|
472
473
|
{GREEN}t td add <what to do>{RESET} {GRAY}the rest of the line is the name{RESET}
|
|
474
|
+
{GREEN}t td add milk n oat{RESET} {GRAY}up to {GREEN}n{GRAY} or {GREEN}s{GRAY}, then the note or status{RESET}
|
|
473
475
|
{GREEN}t td done <selection>{RESET} {GRAY}stamps it and marks it {GREEN}done{RESET}
|
|
474
476
|
{GREEN}t td reopen <selection>{RESET} {GRAY}puts it back{RESET}
|
|
475
477
|
{GREEN}t td clear{RESET} {GRAY}removes every finished one{RESET}
|
|
@@ -499,6 +501,8 @@
|
|
|
499
501
|
{GREEN}t td 3 done{RESET} {GRAY}the same as {GREEN}t td done 3{RESET}
|
|
500
502
|
{GREEN}t td 3 st blocked{RESET}
|
|
501
503
|
{GREEN}t td 3 nt {r}broken{/} build{RESET}
|
|
504
|
+
{GREEN}t td the docs n ok{RESET} {GRAY}every word up to the action names the todo{RESET}
|
|
505
|
+
{GREEN}t td milk n oat{RESET} {GRAY}offers to add one when nothing is called that{RESET}
|
|
502
506
|
|
|
503
507
|
{GRAY}Editing takes the same fields and short forms as a project does:{RESET}
|
|
504
508
|
|
|
@@ -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
|
|