Skip to content

Commit e3be87c

Browse files
committed
fix(Help and Version): only builds help and version once
1 parent 3fcdc6f commit e3be87c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/app/app.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2656,6 +2656,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
26562656
};
26572657
self.long_list.push("help");
26582658
self.flags.insert("hclap_help", arg);
2659+
self.settings.unset(&AppSettings::NeedsLongHelp);
26592660
}
26602661
if self.settings.is_set(&AppSettings::NeedsLongVersion) &&
26612662
!self.settings.is_set(&AppSettings::VersionlessSubcommands) ||
@@ -2677,10 +2678,12 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
26772678
};
26782679
self.long_list.push("version");
26792680
self.flags.insert("vclap_version", arg);
2681+
self.settings.unset(&AppSettings::NeedsLongVersion);
26802682
}
26812683
if self.settings.is_set(&AppSettings::NeedsSubcommandHelp) && !self.subcommands.is_empty() {
26822684
self.subcommands.insert("help".to_owned(), App::new("help")
26832685
.about("Prints this message"));
2686+
self.settings.unset(&AppSettings::NeedsSubcommandHelp);
26842687
}
26852688
}
26862689

0 commit comments

Comments
 (0)