`ParseFailure::exit_code` no longer prints msg in 0.9.10
My program has been doing the following for quite a while.
let args = match args()
.fallback_to_usage()
.run_inner(bpaf::Args::current_args().set_name(progname))
{
Ok(a) => a,
Err(e) => std::process::exit(e.exit_code()),
};
https://github.com/scottlamb/moonfire-nvr/blob/06f942582c77ee5b99d4cc7353b0433e69fa3a9c/server/src/main.rs#L91-L97
When updating past 0.9.10 I see that running without args no longer prints usage. This was surprising in a point release and doesn't seem to be mentioned in 0.9.10's changelog either.
Looks like d987864758dffcab042db252ec1ee6a591d13484 changed the behavior of ParseFailure::exit_code to no longer print the message. I'd call this a breaking change (major behavior of a public method dropped) although at least it fits the method name better now.
I know I'm months late to the party, but maybe at least a changelog addition would help?
btw, a couple nits:
- the new
ParseFailure::print_mesageis misspelled. - it's a little weird that I have to explicitly specify
max_widthmyself. I'd like to say "do whatever you do for everything else". But looks like I can only override what's used for everything else viaOptionParser::max_width, not query the current or default value. It'd be nice if themax_widthwere bundled into theParseFailure, but I guess since it's anenumthere's no place to stash it without an API break.
Hi Scott
Thank you for letting me know about the issues. While I do have a bunch of text covering parsing behavior - other parts are not covered as well without me realizing it. I should probably add some of those.
I'm going to update the changelog, will try to address some of the issues you pointed out in this version and look for approaches to testing it and a better api for 0.10