|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -from collections.abc import Mapping, Sequence |
| 5 | +from collections.abc import Iterator, Mapping, Sequence |
6 | 6 | import dataclasses |
7 | 7 | import enum |
8 | 8 | import functools |
|
15 | 15 | import jinja2 |
16 | 16 |
|
17 | 17 | from .bots import Worktree |
18 | | -from .common import Config, Table, package_root |
| 18 | +from .common import Config, package_root |
19 | 19 | from .worktrees import EmptyWorktree |
20 | 20 |
|
21 | 21 |
|
@@ -210,17 +210,14 @@ def find_prompt_metadata(name: PromptName) -> PromptMetadata | None: |
210 | 210 | return prompt.metadata |
211 | 211 |
|
212 | 212 |
|
213 | | -def templates_table(*, include_local: bool = True) -> Table: |
| 213 | +def list_templates(*, include_local: bool = True) -> Iterator[str]: |
214 | 214 | env = _jinja_environment(include_local=include_local) |
215 | 215 | worktree = EmptyWorktree() |
216 | | - table = Table.empty() |
217 | | - table.data.field_names = ["name", "local", "description"] |
218 | 216 | for rel_path in env.list_templates(extensions=[_extension]): |
219 | 217 | if any(p.startswith(".") for p in rel_path.split(os.sep)): |
220 | 218 | continue |
221 | 219 | name, _ext = os.path.splitext(rel_path) |
222 | 220 | prompt = _load_prompt(env, name, worktree) |
223 | 221 | metadata = prompt.metadata |
224 | 222 | local = "y" if metadata.is_local() else "n" |
225 | | - table.data.add_row([name, local, metadata.description or ""]) |
226 | | - return table |
| 223 | + yield "\t".join([name, local, metadata.description or ""]) |
0 commit comments