Skip to main content

dispatch

Function dispatch 

Source
pub async fn dispatch<I, T>(
    plugins: &[Box<dyn Plugin>],
    args: I,
) -> Result<DispatchOutcome, CliError>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Expand description

Dispatch CLI args across the registered plugins’ commands.

args is the raw std::env::args_os() slice including argv[0]. The dispatcher builds a top-level clap::Command named after argv[0], hangs every plugin’s contributed subcommand off it, and matches.

Duplicate command names across plugins are caught here (as a build-time would be ideal, but the plugin set isn’t known at build time): the second plugin to register the same name loses, and a warning is logged.