This commit is contained in:
2026-05-16 15:26:08 -07:00
parent 5048729b0c
commit 02d84f423e
10 changed files with 488 additions and 470 deletions
+15 -12
View File
@@ -1,22 +1,25 @@
Selector & plugin-table usage
Selector and `plugin-table` usage
This project provides a small plugin/table/selector flow that allows plugins
and cmdlets to interact via a simple, pipable API.
This project provides a small plugin/table/selector flow that lets plugins and
cmdlets interact through a simple pipable API.
Key ideas
- `plugin-table` renders a plugin result set and *emits* pipeline-friendly dicts for each row. Each emitted item includes `_selection_args`, a list of args the plugin suggests for selecting that row (e.g., `['-path', '/tmp/file']`).
- Use the `@N` syntax to select an item from a table and chain it to the next cmdlet.
Key ideas:
- `plugin-table` renders a plugin result set and emits pipeline-friendly dicts for each row.
- Emitted rows can include `_selection_args` and, when needed, `_selection_action` for exact row replay.
- Use `@N` to select an item from a table and chain it to the next cmdlet.
Example:
plugin-table -plugin example -sample | @1 | add-file -instance default
What plugins must implement
- An adapter that yields `ResultModel` objects (breaking API).
- Optionally supply a `columns` factory and `selection_fn` (see `plugins/example_provider.py`).
What plugins must implement:
- An adapter that yields `ResultModel` objects.
- Optionally a `columns` factory and `selection_fn`.
Implementation notes
Implementation notes:
- `plugin-table` emits dicts like `{ 'title': ..., 'path': ..., 'metadata': ..., '_selection_args': [...] }`.
- Selection syntax (`@1`) will prefer `_selection_args` if present; otherwise it will fall back to plugin selection logic or sensible defaults (`-path` or `-title`).
- When a row includes `_selection_action`, `@1` prefers that exact action.
- Otherwise `@1` falls back to `_selection_args`, then plugin selection logic, then sensible defaults such as `-path` or `-title`.
This design keeps the selector-focused UX small and predictable while enabling full cmdlet interoperability via piping and `-run-cmd`.
This design keeps selector-focused workflows small and predictable while still
allowing full cmdlet interoperability through piping and `-run-cmd`.