Provide possibility to overwrite version #2129
Answered
by
pksunkara
nicolaiunrein
asked this question in
Q&A
-
Rust Versionrustc 1.46.0 Affected Version of clap3.0.0-beta.1 Expected Behavior SummaryProvide possibility to overwrite how the Actual Behavior SummaryClap prints version prefixed with binary name even if I specify Steps to Reproduce the issueRun the example Sample Code or Link to Sample Codeuse clap::Clap;
#[derive(Clap)]
#[clap(author = "Author", name = "example")]
struct Opts {
/// Print version and exit
#[clap(short, long)]
version: bool,
}
fn main() {
let opts = Opts::parse();
if opts.version {
println!("TEST_VERSION");
}
} Running |
Beta Was this translation helpful? Give feedback.
Answered by
pksunkara
Sep 10, 2020
Replies: 2 comments 6 replies
-
https://docs.rs/clap/2.33.3/clap/enum.AppSettings.html#variant.DisableVersion |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
pksunkara
-
For anyone who look to override default version: #[derive(Parser, Debug)]
#[command(author, version, about, long_about = None, disable_version_flag = true)]
struct Args {
...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.rs/clap/2.33.3/clap/enum.AppSettings.html#variant.DisableVersion