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

Adding a version after calling print_help does not update for another print_help #4183

Closed
2 tasks done
ModProg opened this issue Sep 6, 2022 · 1 comment
Closed
2 tasks done
Labels
C-bug Category: Updating dependencies

Comments

@ModProg
Copy link
Contributor

ModProg commented Sep 6, 2022

Please complete the following tasks

Rust Version

rustc 1.63.0 (4b91a6ea7 2022-08-08)

Clap Version

master

Minimal reproducible code

use clap::Command;

fn main() {
    let mut command = Command::new("test");
    command.print_help();
    command = command.version("123");
    command.print_help();
}

Steps to reproduce the bug with the above code

cargo run

Actual Behaviour

prints same help twice:

Usage:
    test

Options:
    -h, --help    Print help information
Usage:
    test

Options:
    -h, --help    Print help information

Expected Behaviour

prints -V on second help:

Usage:
    test

Options:
    -h, --help    Print help information
Usage:
    test

Options:
    -h, --help       Print help information
    -V, --version    Print version information

Additional Context

also applies to parsing i.e. -V will show an error that it does not exists.

Debug Output

No response

@ModProg ModProg added the C-bug Category: Updating dependencies label Sep 6, 2022
@epage
Copy link
Member

epage commented Sep 6, 2022

I believe this would be a subset of #2911

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

2 participants