Skip to content

Commit

Permalink
fix(Help and Version): only builds help and version once
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Oct 28, 2015
1 parent 3fcdc6f commit e3be87c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
};
self.long_list.push("help");
self.flags.insert("hclap_help", arg);
self.settings.unset(&AppSettings::NeedsLongHelp);
}
if self.settings.is_set(&AppSettings::NeedsLongVersion) &&
!self.settings.is_set(&AppSettings::VersionlessSubcommands) ||
Expand All @@ -2677,10 +2678,12 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
};
self.long_list.push("version");
self.flags.insert("vclap_version", arg);
self.settings.unset(&AppSettings::NeedsLongVersion);
}
if self.settings.is_set(&AppSettings::NeedsSubcommandHelp) && !self.subcommands.is_empty() {
self.subcommands.insert("help".to_owned(), App::new("help")
.about("Prints this message"));
self.settings.unset(&AppSettings::NeedsSubcommandHelp);
}
}

Expand Down

0 comments on commit e3be87c

Please sign in to comment.