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

Multiple optional arguments are displayed incorrectly in help output #4847

Open
2 tasks done
fabianfreyer opened this issue Apr 19, 2023 · 0 comments · May be fixed by #4910
Open
2 tasks done

Multiple optional arguments are displayed incorrectly in help output #4847

fabianfreyer opened this issue Apr 19, 2023 · 0 comments · May be fixed by #4910
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-bug Category: Updating dependencies E-easy Call for participation: Experience needed to fix: Easy / not much

Comments

@fabianfreyer
Copy link

fabianfreyer commented Apr 19, 2023

Please complete the following tasks

Rust Version

rustc 1.66.0 (69f9c33d7 2022-12-12)

Clap Version

v4.2.2

Minimal reproducible code

fn main() {
        let app = Command::new("issue-4847")
        .arg(
            Arg::new("example")
                .long("example")
                .num_args(1..=2)
                .value_names(&["FOO", "BAR"])
        );
}

Steps to reproduce the bug with the above code

cargo run -- --help

Actual Behaviour

The output of --help is:

Usage: issue-4847 [OPTIONS]

Options:
      --example <FOO> <BAR>  
  -h, --help                 Print help

As a side-note, there are trailing spaces in the help output.

Expected Behaviour

The output of --help should indicate that the second parameter is optional, i.e.:

Usage: issue-4847 [OPTIONS]

Options:
      --example <FOO> [<BAR>]
  -h, --help                 Print help

Additional Context

No response

Debug Output

No response

@fabianfreyer fabianfreyer added the C-bug Category: Updating dependencies label Apr 19, 2023
@epage epage added A-help Area: documentation, including docs.rs, readme, examples, etc... E-easy Call for participation: Experience needed to fix: Easy / not much labels Apr 20, 2023
fabianfreyer added a commit to fabianfreyer/clap that referenced this issue May 15, 2023
fabianfreyer added a commit to fabianfreyer/clap that referenced this issue May 15, 2023
fabianfreyer added a commit to fabianfreyer/clap that referenced this issue Jun 14, 2023
fabianfreyer added a commit to fabianfreyer/clap that referenced this issue Jun 14, 2023
fabianfreyer added a commit to fabianfreyer/clap that referenced this issue Jun 19, 2023
fabianfreyer added a commit to fabianfreyer/clap that referenced this issue Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-bug Category: Updating dependencies E-easy Call for participation: Experience needed to fix: Easy / not much
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants