Skip to main content

Module query

Module query 

Source
Expand description

Central command registry with lookup and search operations.

Registry is the primary store for the command tree in an argot application. It owns a Vec<Command> and exposes several query methods:

Pass registry.commands() to crate::Parser::new to wire the registry into the parsing pipeline.

§Example

let registry = Registry::new(vec![
    Command::builder("list").summary("List all items").build().unwrap(),
    Command::builder("get").summary("Get a single item").build().unwrap(),
]);

assert!(registry.get_command("list").is_some());
assert_eq!(registry.search("item").len(), 2);

Structs§

CommandEntry
A command paired with its canonical path from the registry root.
Registry
Owns the registered command tree and provides query/search operations.

Enums§

QueryError
Errors produced by Registry methods.

Functions§

command_to_json_with_fields
Serialize a single Command to a pretty-printed JSON string, filtering the output to only include the requested top-level fields.
command_to_ndjson
Serialize a single Command to a compact (single-line) JSON string.