2026-04-19 00:41:09 -07:00
Selector & plugin-table usage
2026-01-05 13:09:24 -08:00
2026-04-19 00:41:09 -07:00
This project provides a small plugin/table/selector flow that allows plugins
2026-01-05 13:09:24 -08:00
and cmdlets to interact via a simple, pipable API.
Key ideas
2026-04-19 00:41:09 -07:00
- `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']` ).
2026-01-12 12:17:50 -08:00
- Use the `@N` syntax 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-04-19 00:41:09 -07:00
What plugins must implement
2026-01-05 13:09:24 -08:00
- An adapter that yields `ResultModel` objects (breaking API).
2026-04-26 16:49:23 -07:00
- Optionally supply a `columns` factory and `selection_fn` (see `plugins/example_provider.py` ).
2026-01-05 13:09:24 -08:00
Implementation notes
2026-04-19 00:41:09 -07:00
- `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` ).
2026-01-05 13:09:24 -08:00
This design keeps the selector-focused UX small and predictable while enabling full cmdlet interoperability via piping and `-run-cmd` .