Expand description
Cli trait for implementing a user-side command-line processor.
Re-exports§
pub use crate::result::Result;
Macros§
- declare_
handler - Implements the
workflow_terminal::cli::Handlertrait for a given type fromdeclare_handler!(<type>, [<verb>,] <help>), deriving the command verb from the type name (kebab-cased) when one is not supplied. - register_
handlers - Registers a list of command handlers with a target from
register_handlers!(<context>, <target>, [<module names>]), instantiating each handler and attaching it to the target’s command tree.
Structs§
- Handler
Cli - A registry-based
Cliimplementation that dispatches command lines to registeredHandlers keyed by their verb.
Traits§
- Cli
- User-implemented command-line processor driven by a
Terminal. - Context
- Shared execution context passed to command handlers, providing access to the underlying terminal and allowing downcasting to a concrete type.
- Handler
- A single command handler, identified by a verb, that can be registered
with a
HandlerCliand invoked when its verb is entered.
Functions§
- get_
handler_ help - Returns the help text for a handler, preferring static
Handler::helpand falling back toHandler::dyn_helpwhen the static text is empty.
Derive Macros§
- Handler
- Derives a
workflow_terminal::cli::Handlerimplementation for the annotated type, taking the command verb andhelptext from#[verb(..)]and#[help(..)]attributes and defaulting the verb to the kebab-cased type name.