Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(parser) No usage for unneeded attached value #4268

Closed

Conversation

jpgrayson
Copy link
Contributor

When a value is attached to an option that does not need a value (as in "--flag=value"), the error message included a usage line. However, that usage line, which could be generic generated usage, "smart" usage based off the user-provided command line, or the user-overridden usage. None of these forms of usage provide helpful information for this class of error. The crux of the problem is explained clearly in the error message's first line.

For example, this:

error: The value 'value' was provided to '--flag' but it wasn't expecting any more values

example --other <path>...

For more information try '--help'

Becomes this:

error: The value 'value' was provided to '--flag' but it wasn't expecting any more values

For more information try '--help'

N.B. a motivating factor is that the "no-title" usage in this error message, in addition to being not super useful, was necessarily formatted incorrectly with a user-overridden, multi-line usage string. For example:

error: The value 'value' was provided to '--flag' but it wasn't expecting any more values

example -X <path>...
       example -Y [OPTIONS]
       example -Z [OPTIONS] [path]

For more information try '--help'

Removing usage from this error message side-steps the usage formatting issue.

When a value is attached to an option that does not need a value (as in
"--flag=value"), the error message included a usage line. However, that
usage line, which could be generic generated usage, "smart" usage based off
the user-provided command line, or the user-overridden usage. None of these
forms of usage provide helpful information for this class of error. The
crux of the problem is explained clearly in the error message's first line.

For example, this:

    error: The value 'value' was provided to '--flag' but it wasn't expecting any more values

    example --other <path>...

    For more information try '--help'

Becomes this:

    error: The value 'value' was provided to '--flag' but it wasn't expecting any more values

    For more information try '--help'

N.B. a motivating factor is that the "no-title" usage in this error
message, in addition to being not super useful, was necessarily formatted
incorrectly with a user-overridden, multi-line usage string. For example:

    error: The value 'value' was provided to '--flag' but it wasn't expecting any more values

    example -X <path>...
           example -Y [OPTIONS]
           example -Z [OPTIONS] [path]

    For more information try '--help'

Removing usage from this error message side-steps the usage formatting
issue.
@epage
Copy link
Member

epage commented Sep 27, 2022

I think I prefer we fix up the usage, rather than remove it. I've posted #4269

@epage epage closed this Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants