From eb4913d53ecf0c39a147f7264ba027a00a0bf702 Mon Sep 17 00:00:00 2001 From: Volker Christian Date: Mon, 13 Mar 2023 19:55:04 +0100 Subject: [PATCH] Add REQUIRED to an app-name in case it is listed in the subcommand list of another app. (#860) --- include/CLI/impl/Formatter_inl.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/CLI/impl/Formatter_inl.hpp b/include/CLI/impl/Formatter_inl.hpp index 914774ee..84652fef 100644 --- a/include/CLI/impl/Formatter_inl.hpp +++ b/include/CLI/impl/Formatter_inl.hpp @@ -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(); }