Using the new App:with_defaults displays clap's author and version number.
This is with clap version 2.11.0
Interesting, I hadn't thought about that happenig. Thanks for reporting!
This still happens in 2.11.2, maybe that commit was meant to close #643 instead?
@clux yes, that was a mistake. Thanks!
From @RoPP
Cargo.toml :
[package]
name = "plop"
version = "0.1.0"
authors = ["Plop <[email protected]>"]
[dependencies]
clap = "2.9"
src/main.rs :
extern crate clap;
use clap::App;
fn main() {
App::with_defaults("plop").get_matches();
}
cargo run -- --help
Running `target/debug/plop --help`
Plop 2.14.0 <-------------------
Kevin K. <[email protected]> <--------
USAGE:
plop
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
After a couple of iterations I've approached this from a different angle: what if instead the above src/main.rs looked like this:
#[macro_use]
extern crate clap;
use clap::App;
fn main() {
defaulted_app!("plop").get_matches();
}
Name to be improved, of course.
@nabijaczleweli perhaps. I'm not against that, but also don't want to confuse people with the clap_app! macro, or macro builders.
At this point, I'm also not really against simply deprecating App::with_defaults as broken until we can decide something more elegant during the v3 build up. Because I think the with_defaults doesn't add a whole ton, and can be _very_ easily worked around by using crate_version! and crate_authors!
App::with_defaults() in its current state has 100% _no chance_ of working and tbh I don't really see its value, either.
Agreed.
Darn it, I guess if it doesn't work it doesn't work.
Can I make a ticket to discuss a redesign for v3?
Yeah its deprecated as basically unfixable at this time. :(
On Oct 28, 2016 7:26 AM, "Roman A. Taycher" [email protected]
wrote:
Darn it, I guess if it doesn't work it doesn't work.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/kbknapp/clap-rs/issues/638#issuecomment-256897413,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGntttf68UczkpzFhPLif23H984eG0U1ks5q4dvNgaJpZM4Ju5rb
.
It's because it pulls the info from the compilation of the clap-rs crate right?
And a macro like @nabijaczleweli proposed would work, right?
I was wondering if I could start a ticket to discuss re-design or if there's another place I could put it(forum?)?
I had some other ideas, like possibly putting CARGO_PKG_DESCRIPTION in about.
@rtaycher I'm all for opening an issue/PR which either fixes this, or discusses new ways to accomplish it. There are just other issues which are are a higher priority for myself right now, but if you'd like to open the discussion and try out some fixes I'm all for it :+1:
Most helpful comment
@nabijaczleweli perhaps. I'm not against that, but also don't want to confuse people with the
clap_app!macro, or macro builders.At this point, I'm also not really against simply deprecating
App::with_defaultsas broken until we can decide something more elegant during the v3 build up. Because I think the with_defaults doesn't add a whole ton, and can be _very_ easily worked around by usingcrate_version!andcrate_authors!