Skip to main content

Module vista_cli

Module vista_cli 

Source
Expand description

Vista-backed model-driven CLI runner.

Drives a [Vista] from positional argv tokens. The grammar covers model selection, locator resolution, operator conditions, relation traversal, sort/slice selectors, search, aggregates, column overrides, and JSON-typed value escapes. Backend specifics (which names map to which models, what locator schemes are recognised, how records are rendered) are injected through ModelFactory and Renderer.

§Token forms

  • users / user — model name (plural = list mode, singular = single).
  • arn:…, user:abc123, urn:… — locator; resolved via ModelFactory::for_locator.
  • field=value, field="quoted text" — eq filter; id= is sugar for “narrow to this record”.
  • field=#json-literal — JSON-typed value (#true, #42, #"42 as string", #null, #[1,2,3], #{"k":"v"}).
  • field:lt=value etc. — operator conditions (ne, lt, lte, gt, gte, like, in); field:null / field:notnull are nullary.
  • […] — combined sort + slice selector (see token::Selector). [5] narrows to row 5; [5:15] slices; [+name] sorts ascending; [-name] descending; [+name:0] sorts then narrows.
  • :relation — traverse a typed relation; allowed only from single mode.
  • =col1,col2,… — override the rendered columns.
  • ?keyword / ?"two words" — full-text-ish search.
  • @sum:field, @max:field, @min:field, @count — terminal aggregates.

Glued bracket suffixes are accepted on most tokens (users[0], :rel[0], field=v[0], =col1[0]).

See parse for the full grammar and run for the dispatch.

Re-exports§

pub use factory::ModelFactory;
pub use factory::Renderer;
pub use parse::parse_selector;
pub use parse::parse_token;
pub use parse::split_bracket_suffix;
pub use run::run;
pub use token::AggregateOp;
pub use token::Direction;
pub use token::Mode;
pub use token::Op;
pub use token::Selector;
pub use token::Slice;
pub use token::Token;
pub use value::auto_detect;
pub use value::json_to_cbor;
pub use value::parse_value;
pub use value::parse_value_list;

Modules§

factory
ModelFactory and Renderer traits — the per-backend injection points for the runner.
parse
Argv-token parser. One pure function per public form, plus the top-level parse_token that dispatches based on the leading character and structural cues.
run
Runner: walks the parsed token stream and drives the Vista.
token
Token, operator, and selector types produced by the parser.
value
Value coercion for CLI condition arguments.