Skip to main content

run_and_dispatch

Function run_and_dispatch 

Source
pub fn run_and_dispatch(
    matches: &ArgMatches,
    quiet: bool,
) -> Result<(), SsgError>
Expand description

Tiny shim used by lib.rs::run. Mapped to Result<(), SsgError> so the dispatcher’s call-site stays uniform across subcommands; the non-zero exit is surfaced by a process::exit(1) in the caller.

§Errors

Propagates SsgError from run.

§Examples

use ssg::cmd::audit::{build_subcommand, run_and_dispatch};
let tmp = tempfile::tempdir().unwrap();
let site = tmp.path().join("public");
std::fs::create_dir_all(&site).unwrap();
let cmd = build_subcommand();
let matches = cmd
    .try_get_matches_from(["audit", "--output", site.to_str().unwrap()])
    .unwrap();
run_and_dispatch(&matches, true).unwrap();