Split parse state validation and make parse context arg optional.

This commit is contained in:
2025-11-18 13:00:04 +11:00
parent 75e2bde5fb
commit afffd1ef91
5 changed files with 35 additions and 29 deletions

View File

@@ -44,9 +44,9 @@ extern "C" fn safe_main(args: &[&str]) -> ExitCode {
print!("{}", StandardFullHelpWriter::<'_, Arg>::new(ctx));
return Ok(ParseControl::Quit);
}
Arg::Number => { number = str::parse(ctx.arg)?; }
Arg::File => { file = ctx.arg.into(); }
Arg::Out => { out = Some(ctx.arg.into()); }
Arg::Number => { number = str::parse(ctx.arg.unwrap())?; }
Arg::File => { file = ctx.arg.unwrap().into(); }
Arg::Out => { out = Some(ctx.arg.unwrap().into()); }
}
Ok(ParseControl::Continue)
}, |program_name, error| {