28 label(
"REQUIRED",
"");
44 std::string
make_group(std::string group,
bool is_positional, std::vector<const CLI::Option *> opts)
const override
50 std::stringstream out;
53 out <<
"\n" << group <<
":\n";
55 for (
const auto *opt : opts) {
56 out << make_option(opt, is_positional);
71 std::string
make_expanded(
const CLI::App *sub, CLI::AppFormatMode mode)
const override
73 std::stringstream out;
77 bool is_option_group = sub->get_name().empty() && !sub->get_group().empty();
79 if (is_option_group) {
80 header = sub->get_group();
83 header = sub->get_display_name(
true);
86 out <<
"\n" << header <<
":\n";
89 std::string desc = sub->get_description();
91 out <<
" " << desc <<
"\n";
95 out << make_positionals(sub);
97 if (is_option_group) {
100 std::vector<const CLI::Option *> opts = sub->get_options([sub](
const CLI::Option *opt) {
101 return opt->nonpositional() && sub->get_help_ptr() != opt && sub->get_help_all_ptr() != opt;
104 for (
const CLI::Option *opt : opts) {
105 out << make_option(opt,
false);
110 out << make_groups(sub, mode);
114 out << make_subcommands(sub, mode);
130 std::stringstream out;
132 if (!opt->get_option_text().empty()) {
133 out <<
" " << opt->get_option_text();
136 if (opt->get_type_size() != 0) {
137 if (!opt->get_type_name().empty()) {
138 std::string type_name = opt->get_type_name();
142 std::size_t colon_pos = type_name.find(
':');
143 if (colon_pos != std::string::npos) {
144 type_name = type_name.substr(0, colon_pos);
148 std::string label_val = get_label(type_name);
149 if (!label_val.empty()) {
150 out <<
" " << label_val;
153 if (!opt->get_default_str().empty()) {
154 out <<
" [" << opt->get_default_str() <<
"]";
156 if (opt->get_expected_max() == CLI::detail::expected_max_vector_size) {
159 else if (opt->get_expected_min() > 1) {
160 out <<
" x " << opt->get_expected();
163 if (opt->get_required()) {
164 std::string req_label = get_label(
"REQUIRED");
165 if (!req_label.empty()) {
166 out <<
" " << req_label;
170 if (!opt->get_envname().empty()) {
171 out <<
" (" << get_label(
"Env") <<
":" << opt->get_envname() <<
")";
173 if (!opt->get_needs().empty()) {
174 out <<
" " << get_label(
"Needs") <<
":";
175 for (
const CLI::Option *op : opt->get_needs()) {
176 out <<
" " << op->get_name();
179 if (!opt->get_excludes().empty()) {
180 out <<
" " << get_label(
"Excludes") <<
":";
181 for (
const CLI::Option *op : opt->get_excludes()) {
182 out <<
" " << op->get_name();