2026-05-16 15:26:08 -07:00
|
|
|
Selector and `plugin-table` usage
|
2026-01-05 13:09:24 -08:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
This project provides a small plugin/table/selector flow that lets plugins and
|
|
|
|
|
cmdlets interact through a simple pipable API.
|
2026-01-05 13:09:24 -08:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
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.
|
2026-01-05 13:09:24 -08:00
|
|
|
|
2026-01-12 12:17:50 -08:00
|
|
|
Example:
|
2026-01-05 13:09:24 -08:00
|
|
|
|
2026-05-03 21:20:05 -07:00
|
|
|
plugin-table -plugin example -sample | @1 | add-file -instance default
|
2026-01-05 13:09:24 -08:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
What plugins must implement:
|
|
|
|
|
- An adapter that yields `ResultModel` objects.
|
|
|
|
|
- Optionally a `columns` factory and `selection_fn`.
|
2026-01-05 13:09:24 -08:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
Implementation notes:
|
2026-04-19 00:41:09 -07:00
|
|
|
- `plugin-table` emits dicts like `{ 'title': ..., 'path': ..., 'metadata': ..., '_selection_args': [...] }`.
|
2026-05-16 15:26:08 -07:00
|
|
|
- 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`.
|
2026-01-05 13:09:24 -08:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
This design keeps selector-focused workflows small and predictable while still
|
|
|
|
|
allowing full cmdlet interoperability through piping and `-run-cmd`.
|