26 label(
"REQUIRED",
"");
40 std::string
make_group(std::string group,
bool is_positional, std::vector<const CLI::Option *> opts)
const override
46 std::stringstream out;
49 out <<
"\n" << group <<
":\n";
51 for (
const auto *opt : opts) {
52 out << make_option(opt, is_positional);
65 std::string
make_expanded(
const CLI::App *sub, CLI::AppFormatMode mode)
const override
67 std::stringstream out;
71 bool is_option_group = sub->get_name().empty() && !sub->get_group().empty();
73 if (is_option_group) {
74 header = sub->get_group();
77 header = sub->get_display_name(
true);
80 out <<
"\n" << header <<
":\n";
83 std::string desc = sub->get_description();
85 out <<
" " << desc <<
"\n";
89 out << make_positionals(sub);
91 if (is_option_group) {
94 std::vector<const CLI::Option *> opts = sub->get_options([sub](
const CLI::Option *opt) {
95 return opt->nonpositional() && sub->get_help_ptr() != opt && sub->get_help_all_ptr() != opt;
98 for (
const CLI::Option *opt : opts) {
99 out << make_option(opt,
false);
104 out << make_groups(sub, mode);
108 out << make_subcommands(sub, mode);
122 std::stringstream out;
124 if (!opt->get_option_text().empty()) {
125 out <<
" " << opt->get_option_text();
128 if (opt->get_type_size() != 0) {
129 if (!opt->get_type_name().empty()) {
130 std::string type_name = opt->get_type_name();
134 std::size_t colon_pos = type_name.find(
':');
135 if (colon_pos != std::string::npos) {
136 type_name = type_name.substr(0, colon_pos);
140 std::string label_val = get_label(type_name);
141 if (!label_val.empty()) {
142 out <<
" " << label_val;
145 if (!opt->get_default_str().empty()) {
146 out <<
" [" << opt->get_default_str() <<
"]";
148 if (opt->get_expected_max() == CLI::detail::expected_max_vector_size) {
151 else if (opt->get_expected_min() > 1) {
152 out <<
" x " << opt->get_expected();
155 if (opt->get_required()) {
156 std::string req_label = get_label(
"REQUIRED");
157 if (!req_label.empty()) {
158 out <<
" " << req_label;
162 if (!opt->get_envname().empty()) {
163 out <<
" (" << get_label(
"Env") <<
":" << opt->get_envname() <<
")";
165 if (!opt->get_needs().empty()) {
166 out <<
" " << get_label(
"Needs") <<
":";
167 for (
const CLI::Option *op : opt->get_needs()) {
168 out <<
" " << op->get_name();
171 if (!opt->get_excludes().empty()) {
172 out <<
" " << get_label(
"Excludes") <<
":";
173 for (
const CLI::Option *op : opt->get_excludes()) {
174 out <<
" " << op->get_name();