Closed davidkna closed 2 years ago
similar:https://github.com/baoyachi/shadow-rs/issues/68 @davidkna
Hi @davidkna . Now shadow-rs 0.10.0 version can support this question.
Notice :Now, you can use Upper const CLAP_LONG_VERSION
, not clap_long_version()
E.g:
[dependencies]
shadow-rs = "0.10.1"
[build-dependencies]
shadow-rs = "0.10.1"
use clap::Parser;
use crate::build::CLAP_LONG_VERSION;
use shadow_rs::shadow;
shadow!(build);
#[derive(Parser, Debug)]
#[clap(long_version = CLAP_LONG_VERSION)]
struct Config {
foo: String,
}
fn main() {
println!("{:?}", Config::parse());
}
DONE .
Thanks!
Right now,
clap_long_version()
(despite the name) is not supported as an argument with clap-derive via#[clap(long_version = clap_long_version())]
Sample:
Shadow-rs should work as-is in this scenario, without any wrapper function such as this: