1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-05 06:33:52 +00:00

Add REQUIRED to an app-name in case it is listed in the subcommand list of another app. (#860)

This commit is contained in:
Volker Christian 2023-03-13 19:55:04 +01:00 committed by GitHub
parent 18a256ec85
commit eb4913d53e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ CLI11_INLINE std::string Formatter::make_description(const App *app) const {
auto min_options = app->get_require_option_min();
auto max_options = app->get_require_option_max();
if(app->get_required()) {
desc += " REQUIRED ";
desc += " " + get_label("REQUIRED") + " ";
}
if((max_options == min_options) && (min_options > 0)) {
if(min_options == 1) {
@ -213,7 +213,10 @@ CLI11_INLINE std::string Formatter::make_subcommands(const App *app, AppFormatMo
CLI11_INLINE std::string Formatter::make_subcommand(const App *sub) const {
std::stringstream out;
detail::format_help(out, sub->get_display_name(true), sub->get_description(), column_width_);
detail::format_help(out,
sub->get_display_name(true) + (sub->get_required() ? " " + get_label("REQUIRED") : ""),
sub->get_description(),
column_width_);
return out.str();
}