pub fn outcome<'v, T>(
spec: &Spec<'_>,
root: &Command<'_>,
argv: &[&'v OsStr],
parse_from: impl FnOnce(&[&'v OsStr]) -> Result<T, Error<'static, 'v>>,
) -> Outcome<T>Expand description
Parse one command line without printing or ending the host process.
Pass the CLI’s own parse_from function item:
ⓘ
match usage::embedded::outcome(Cli::spec(), Cli::command(), &argv, Cli::parse_from) {
usage::embedded::Outcome::Parsed(cli) => run(cli),
usage::embedded::Outcome::Exit(exit) => host.respond(exit),
}Help and version go to stdout with status 0. Help produced by arg_required_else_help and
parse failures go to stderr with status 2. Rendering follows the terminal attached to the
destination stream and honors NO_COLOR and CLICOLOR_FORCE.
The version response uses the portable identity in spec. A CLI whose version or binary name
is computed at runtime should handle Error::Version itself so it can use that runtime value.