Skip to content

ParseFailure::exit_code no longer prints msg in 0.9.10 #385

Description

@scottlamb

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 d987864 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_mesage is misspelled.
  • it's a little weird that I have to explicitly specify max_width myself. 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 via OptionParser::max_width, not query the current or default value. It'd be nice if the max_width were bundled into the ParseFailure, but I guess since it's an enum there's no place to stash it without an API break.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions