-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
PropagateGlobalValuesDown not working when arg has default value #1010
Comments
I also wrote a small test programm with the debug feature enabled: extern crate clap;
use clap::{App, Arg, SubCommand, AppSettings};
fn main() {
let m = App::new("myprog")
.setting(AppSettings::PropagateGlobalValuesDown)
.arg(
Arg::with_name("loglevel")
.help("loglevel")
.takes_value(true)
.short("l")
.long("loglevel")
.global(true)
.default_value("info"),
)
.subcommand(SubCommand::with_name("foo"))
.get_matches_from_safe(vec!["myprog", "-l", "trace", "foo"]);
let m = m.unwrap();
let sub_m = m.subcommand_matches("foo").unwrap();
println!("m: {:#?}", m);
println!("sub_m: {:#?}", sub_m);
}
|
Sorry for the long wait, I've been swamped with work traveling for the past month and a half. This may also be related to #978 Once it's fixed I'll double check that this is still the case and close/fix appropriately. |
No worries. I saw the other issue that's where I got option from but was unsure if it was related. Thx for your amazing work. |
@AlexanderThaller could you test this with the current master branch and see if it's fixed? #1070 just merged which may have helped. If not I can look into it. |
Works fine thank you for your work. |
Please use the following template to assist with creating an issue and getting a speedy resolution. If an area is not applicable, feel free to delete the area, or mark with
N/A
Rust Version
rustc 1.19.0 (0ade33941 2017-07-17)
Affected Version of clap
2.25.1
Expected Behavior Summary
The subcommand arg should inherit the set value instead of using the default value.
Actual Behavior Summary
The subcommand arg uses the default value even if the parent has a different value.
Sample Code or Link to Sample Code
Fails with
The text was updated successfully, but these errors were encountered: