Skip to main content

Module cli

Module cli 

Source
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::Handler trait for a given type from declare_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§

HandlerCli
A registry-based Cli implementation that dispatches command lines to registered Handlers 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 HandlerCli and invoked when its verb is entered.

Functions§

get_handler_help
Returns the help text for a handler, preferring static Handler::help and falling back to Handler::dyn_help when the static text is empty.

Derive Macros§

Handler
Derives a workflow_terminal::cli::Handler implementation for the annotated type, taking the command verb and help text from #[verb(..)] and #[help(..)] attributes and defaulting the verb to the kebab-cased type name.