Skip to main content

dispatch

Function dispatch 

Source
pub async fn dispatch(
    command: Option<Command>,
    yes: bool,
    color: ColorChoice,
    reader: &mut impl BufRead,
    config: &Arc<Config>,
    database: Arc<Database>,
) -> Result<(), CliError>
Expand description

Routes a parsed command to its handler.

The library’s entry point. Everything above it — parsing argv, loading the configuration, installing the subscriber, opening the database, printing a failure and exiting — lives in src/main.rs, because those are the binary’s job and not a library’s: nothing that links this crate can use a function whose failure mode is std::process::exit.

Takes the --color choice rather than a resolved Palette, and resolves it here: the answer depends on whether this process’s stdout is a terminal and on NO_COLOR, and neither belongs in main.rs, which is excluded from the coverage floor precisely because nothing in it is reachable from a test.