mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
Merge #2102
2102: Fix propagation r=pksunkara a=CreepySkeleton Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
This commit is contained in:
commit
7853903052
2 changed files with 16 additions and 1 deletions
|
@ -2139,6 +2139,8 @@ impl<'help> App<'help> {
|
|||
// Make sure all the globally set flags apply to us as well
|
||||
self.settings = self.settings | self.g_settings;
|
||||
|
||||
self._propagate(Propagation::Full);
|
||||
|
||||
self._derive_display_order();
|
||||
self._create_help_and_version();
|
||||
|
||||
|
@ -2242,8 +2244,11 @@ impl<'help> App<'help> {
|
|||
$sc.max_w = $_self.max_w;
|
||||
}
|
||||
{
|
||||
// FIXME: This doesn't belong here at all.
|
||||
for a in $_self.args.args.iter().filter(|a| a.global) {
|
||||
$sc.args.push(a.clone());
|
||||
if $sc.find(&a.id).is_none() {
|
||||
$sc.args.push(a.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}};
|
||||
|
|
|
@ -51,3 +51,13 @@ fn app_send_sync() {
|
|||
fn foo<T: Send + Sync>(_: T) {}
|
||||
foo(App::new("test"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_2090() {
|
||||
let mut app = App::new("app")
|
||||
.global_setting(AppSettings::DisableVersion)
|
||||
.subcommand(App::new("sub"));
|
||||
app._build();
|
||||
|
||||
assert!(app.subcommands[0].is_set(AppSettings::DisableVersion));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue