1.2 KiB
1.2 KiB
Selector & plugin-table usage
This project provides a small plugin/table/selector flow that allows plugins and cmdlets to interact via a simple, pipable API.
Key ideas
plugin-tablerenders 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
@Nsyntax 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
ResultModelobjects (breaking API). - Optionally supply a
columnsfactory andselection_fn(seeplugins/example_provider.py).
Implementation notes
plugin-tableemits dicts like{ 'title': ..., 'path': ..., 'metadata': ..., '_selection_args': [...] }.- Selection syntax (
@1) will prefer_selection_argsif present; otherwise it will fall back to plugin selection logic or sensible defaults (-pathor-title).
This design keeps the selector-focused UX small and predictable while enabling full cmdlet interoperability via piping and -run-cmd.