$mermaidjs
CLI11 2.7.2
C++11 Command Line Interface Parser
Loading...
Searching...
No Matches
Formatter_inl.hpp
1// Copyright (c) 2017-2026, University of Cincinnati, developed by Henry Schreiner
2// under NSF AWARD 1414736 and by the respective contributors.
3// All rights reserved.
4//
5// SPDX-License-Identifier: BSD-3-Clause
6
7#pragma once
8
9// IWYU pragma: private, include "CLI/CLI.hpp"
10
11// This include is only needed for IDEs to discover symbols
12#include "../Formatter.hpp"
13
14// [CLI11:public_includes:set]
15#include <algorithm>
16#include <functional>
17#include <iomanip>
18#include <map>
19#include <set>
20#include <sstream>
21#include <string>
22#include <utility>
23#include <vector>
24// [CLI11:public_includes:end]
25
26namespace CLI {
27// [CLI11:formatter_inl_hpp:verbatim]
28namespace detail {
29CLI11_INLINE std::string indent_block(const std::string &input, const std::string &indent) {
30 std::stringstream out;
31 bool line_start = true;
32
33 for(char ch : input) {
34 if(line_start && ch != '\n') {
35 out << indent;
36 }
37 out << ch;
38 line_start = (ch == '\n');
39 }
40
41 return out.str();
42}
43} // namespace detail
44
45CLI11_INLINE void FormatterBase::long_option_alignment_ratio(float ratio) {
47 (ratio >= 0.0f) ? ((ratio <= 1.0f) ? ratio : 1.0f / ratio) : ((ratio < -1.0f) ? 1.0f / (-ratio) : -ratio);
48}
49
50CLI11_NODISCARD CLI11_INLINE std::string FormatterBase::get_label(std::string key) const {
51 auto it = labels_.find(key);
52 return it != labels_.end() ? it->second : default_label(key);
53}
54
55CLI11_INLINE FormatterLambda::FormatterLambda(funct_t funct) : lambda_(std::move(funct)) {}
56
57CLI11_INLINE std::string FormatterLambda::make_help(const App *app, std::string name, AppFormatMode mode) const {
58 return lambda_(app, name, mode);
59}
60
61CLI11_INLINE std::string
62Formatter::make_group(std::string group, bool is_positional, std::vector<const Option *> opts) const {
63 std::stringstream out;
64
65 out << "\n" << group << ":\n";
66 for(const Option *opt : opts) {
67 out << make_option(opt, is_positional);
68 }
69
70 return out.str();
71}
72
73CLI11_INLINE std::string Formatter::make_positionals(const App *app) const {
74 std::vector<const Option *> opts =
75 app->get_options([](const Option *opt) { return !opt->get_group().empty() && opt->get_positional(); });
76
77 if(opts.empty())
78 return {};
79
80 return make_group(get_label("POSITIONALS"), true, opts);
81}
82
83CLI11_INLINE std::string Formatter::make_groups(const App *app, AppFormatMode mode) const {
84 std::stringstream out;
85 std::vector<std::string> groups = app->get_groups();
86
87 // Options
88 for(const std::string &group : groups) {
89 std::vector<const Option *> opts = app->get_options([app, mode, &group](const Option *opt) {
90 return opt->get_group() == group // Must be in the right group
91 && opt->nonpositional() // Must not be a positional
92 && (mode != AppFormatMode::Sub // If mode is Sub, then
93 || (app->get_help_ptr() != opt // Ignore help pointer
94 && app->get_help_all_ptr() != opt)); // Ignore help all pointer
95 });
96 if(!group.empty() && !opts.empty()) {
97 out << make_group(group, false, opts);
98
99 // Removed double newline between groups for consistency of help text
100 // if(group != groups.back())
101 // out << "\n";
102 }
103 }
104
105 return out.str();
106}
107
108CLI11_INLINE std::string Formatter::make_description(const App *app) const {
109 std::string desc = app->get_description();
110 auto min_options = app->get_require_option_min();
111 auto max_options = app->get_require_option_max();
112
113 if(app->get_required()) {
114 desc += " " + get_label("REQUIRED") + " ";
115 }
116
117 if(min_options > 0) {
118 if(max_options == min_options) {
119 desc += " \n[Exactly " + std::to_string(min_options) + " of the following options are required]";
120 } else if(max_options > 0) {
121 desc += " \n[Between " + std::to_string(min_options) + " and " + std::to_string(max_options) +
122 " of the following options are required]";
123 } else {
124 desc += " \n[At least " + std::to_string(min_options) + " of the following options are required]";
125 }
126 } else if(max_options > 0) {
127 desc += " \n[At most " + std::to_string(max_options) + " of the following options are allowed]";
128 }
129
130 return (!desc.empty()) ? desc + "\n\n" : std::string{};
131}
132
133CLI11_INLINE std::string Formatter::make_usage(const App *app, std::string name) const {
134 std::string usage = app->get_usage();
135 if(!usage.empty()) {
136 return usage + "\n\n";
137 }
138
139 std::stringstream out;
140 out << '\n';
141
142 if(name.empty())
143 out << get_label("Usage") << ':';
144 else
145 out << name;
146
147 std::vector<std::string> groups = app->get_groups();
148
149 // Print an Options badge if any options exist
150 std::vector<const Option *> non_pos_options =
151 app->get_options([](const Option *opt) { return opt->nonpositional(); });
152 if(!non_pos_options.empty())
153 out << " [" << get_label("OPTIONS") << "]";
154
155 // Positionals need to be listed here
156 std::vector<const Option *> positionals =
157 app->get_options([](const Option *opt) { return !opt->get_group().empty() && opt->get_positional(); });
158
159 // Print out positionals if any are left
160 if(!positionals.empty()) {
161 // Convert to help names
162 std::vector<std::string> positional_names;
163 positional_names.reserve(positionals.size());
164 for(const auto *opt : positionals) {
165 positional_names.push_back(make_option_usage(opt));
166 }
167
168 out << " " << detail::join(positional_names, " ");
169 }
170
171 // Add a marker if subcommands are expected or optional
172 if(!app->get_subcommands(
173 [](const CLI::App *subc) { return ((!subc->get_disabled()) && (!subc->get_name().empty())); })
174 .empty()) {
175 out << ' ' << (app->get_require_subcommand_min() == 0 ? "[" : "")
176 << get_label(app->get_require_subcommand_max() == 1 ? "SUBCOMMAND" : "SUBCOMMANDS")
177 << (app->get_require_subcommand_min() == 0 ? "]" : "");
178 }
179
180 out << "\n\n";
181
182 return out.str();
183}
184
185CLI11_INLINE std::string Formatter::make_footer(const App *app) const {
186 std::string footer = app->get_footer();
187 if(footer.empty()) {
188 return std::string{};
189 }
190 return '\n' + footer + '\n';
191}
192
193CLI11_INLINE std::string Formatter::make_help(const App *app, std::string name, AppFormatMode mode) const {
194 // This immediately forwards to the make_expanded method. This is done this way so that subcommands can
195 // have overridden formatters
196 if(mode == AppFormatMode::Sub)
197 return make_expanded(app, mode);
198
199 std::stringstream out;
200 if((app->get_name().empty()) && (app->get_parent() != nullptr)) {
201 if(app->get_group() != "SUBCOMMANDS") {
202 out << app->get_group() << ':';
203 }
204 }
206 detail::streamOutAsParagraph(
207 out, make_description(app), description_paragraph_width_, ""); // Format description as paragraph
208 } else {
209 out << make_description(app);
210 }
211 out << make_usage(app, name);
212 out << make_positionals(app);
213 out << make_groups(app, mode);
214 out << make_subcommands(app, mode);
215 std::string footer_string = make_footer(app);
216
218 detail::streamOutAsParagraph(out, footer_string, footer_paragraph_width_); // Format footer as paragraph
219 } else {
220 out << footer_string;
221 }
222
223 return out.str();
224}
225
226CLI11_INLINE std::string Formatter::make_subcommands(const App *app, AppFormatMode mode) const {
227 std::stringstream out;
228
229 std::vector<const App *> subcommands = app->get_subcommands({});
230
231 // Make a list in definition order of the groups seen
232 std::vector<std::string> subcmd_groups_seen;
233 for(const App *com : subcommands) {
234 if(com->get_name().empty()) {
235 if(!com->get_group().empty() && com->get_group().front() != '+') {
236 auto expanded = make_expanded(com, mode);
237 // add expansion in one place so each group has subgroups beneath it
238 out << expanded;
239 }
240 continue;
241 }
242 std::string group_key = com->get_group();
243 std::string group_key_lower = detail::to_lower(group_key);
244 if(!group_key.empty() &&
245 std::find_if(subcmd_groups_seen.begin(), subcmd_groups_seen.end(), [&group_key_lower](const std::string &a) {
246 return detail::to_lower(a) == group_key_lower;
247 }) == subcmd_groups_seen.end())
248 subcmd_groups_seen.push_back(group_key);
249 }
250
251 // For each group, filter out and print subcommands
252 for(const std::string &group : subcmd_groups_seen) {
253 out << '\n' << group << ":\n";
254 std::vector<const App *> subcommands_group = app->get_subcommands(
255 [&group](const App *sub_app) { return detail::to_lower(sub_app->get_group()) == detail::to_lower(group); });
256 for(const App *new_com : subcommands_group) {
257 if(new_com->get_name().empty())
258 continue;
259 if(mode != AppFormatMode::All) {
260 out << make_subcommand(new_com);
261 } else {
262 out << new_com->help(new_com->get_name(), AppFormatMode::Sub);
263 out << '\n';
264 }
265 }
266 }
267
268 return out.str();
269}
270
271CLI11_INLINE std::string Formatter::make_subcommand(const App *sub) const {
272 std::stringstream out;
273 std::string name = " " + sub->get_display_name(true) + (sub->get_required() ? " " + get_label("REQUIRED") : "");
274
275 out << std::setw(static_cast<int>(column_width_)) << std::left << name;
276
277 const std::string desc = sub->get_description();
278 if(!desc.empty()) {
279 bool skipFirstLinePrefix = true;
280 if(name.length() >= column_width_) {
281 out << '\n';
282 skipFirstLinePrefix = false;
283 }
284 detail::streamOutAsParagraph(
285 out, desc, right_column_width_, std::string(column_width_, ' '), skipFirstLinePrefix);
286 }
287 out << '\n';
288 return out.str();
289}
290
291CLI11_INLINE std::string Formatter::make_expanded(const App *sub, AppFormatMode mode) const {
292 std::stringstream out;
293 const bool is_option_group = sub->get_name().empty();
294 const std::string body_indent = is_option_group ? " " : "";
295
296 out << sub->get_display_name(true) << '\n';
297
299 detail::streamOutAsParagraph(
300 out, make_description(sub), description_paragraph_width_, body_indent); // Format description as paragraph
301 } else {
302 out << detail::indent_block(make_description(sub), body_indent) << '\n';
303 }
304
305 if(sub->get_name().empty() && !sub->get_aliases().empty()) {
306 detail::format_aliases(out, sub->get_aliases(), column_width_ + 2);
307 }
308
309 out << detail::indent_block(make_positionals(sub), body_indent);
310 out << detail::indent_block(make_groups(sub, mode), body_indent);
311 out << detail::indent_block(make_subcommands(sub, mode), body_indent);
312 std::string footer_string = make_footer(sub);
313
314 if(mode == AppFormatMode::Sub && !footer_string.empty()) {
315 const auto *parent = sub->get_parent();
316 std::string parent_footer = (parent != nullptr) ? make_footer(sub->get_parent()) : std::string{};
317 if(footer_string == parent_footer) {
318 footer_string = "";
319 }
320 }
321 if(!footer_string.empty()) {
323 detail::streamOutAsParagraph(out, footer_string, footer_paragraph_width_); // Format footer as paragraph
324 } else {
325 out << footer_string;
326 }
327 }
328 return out.str();
329}
330
331CLI11_INLINE std::string Formatter::make_option(const Option *opt, bool is_positional) const {
332 std::stringstream out;
333 if(is_positional) {
334 const std::string left = " " + make_option_name(opt, true) + make_option_opts(opt);
335 const std::string desc = make_option_desc(opt);
336 out << std::setw(static_cast<int>(column_width_)) << std::left << left;
337
338 if(!desc.empty()) {
339 bool skipFirstLinePrefix = true;
340 if(left.length() >= column_width_) {
341 out << '\n';
342 skipFirstLinePrefix = false;
343 }
344 detail::streamOutAsParagraph(
345 out, desc, right_column_width_, std::string(column_width_, ' '), skipFirstLinePrefix);
346 }
347 } else {
348 const std::string namesCombined = make_option_name(opt, false);
349 const std::string opts = make_option_opts(opt);
350 const std::string desc = make_option_desc(opt);
351
352 // Split all names at comma and sort them into short names and long names
353 const auto names = detail::split(namesCombined, ',');
354 std::vector<std::string> vshortNames;
355 std::vector<std::string> vlongNames;
356 std::for_each(names.begin(), names.end(), [&vshortNames, &vlongNames](const std::string &name) {
357 if(name.find("--", 0) != std::string::npos)
358 vlongNames.push_back(name);
359 else
360 vshortNames.push_back(name);
361 });
362
363 // Assemble short and long names
364 std::string shortNames = detail::join(vshortNames, ", ");
365 std::string longNames = detail::join(vlongNames, ", ");
366
367 // Calculate setw sizes
368 // Short names take enough width to align long names at the desired ratio
369 const auto shortNamesColumnWidth =
370 static_cast<int>(static_cast<float>(column_width_) * long_option_alignment_ratio_);
371 const auto longNamesColumnWidth = static_cast<int>(column_width_) - shortNamesColumnWidth;
372 int shortNamesOverSize = 0;
373
374 // Print short names
375 if(!shortNames.empty()) {
376 shortNames = " " + shortNames; // Indent
377 if(longNames.empty() && !opts.empty())
378 shortNames += opts; // Add opts if only short names and no long names
379 if(!longNames.empty())
380 shortNames += ",";
381 if(static_cast<int>(shortNames.length()) >= shortNamesColumnWidth) {
382 shortNames += " ";
383 shortNamesOverSize = static_cast<int>(shortNames.length()) - shortNamesColumnWidth;
384 }
385 out << std::setw(shortNamesColumnWidth) << std::left << shortNames;
386 } else {
387 out << std::setw(shortNamesColumnWidth) << std::left << "";
388 }
389
390 // Adjust long name column width in case of short names column reaching into long names column
391 shortNamesOverSize =
392 (std::min)(shortNamesOverSize, longNamesColumnWidth); // Prevent negative result with unsigned integers
393 const auto adjustedLongNamesColumnWidth = longNamesColumnWidth - shortNamesOverSize;
394
395 // Print long names
396 if(!longNames.empty()) {
397 if(!opts.empty())
398 longNames += opts;
399 if(static_cast<int>(longNames.length()) >= adjustedLongNamesColumnWidth)
400 longNames += " ";
401
402 out << std::setw(adjustedLongNamesColumnWidth) << std::left << longNames;
403 } else {
404 out << std::setw(adjustedLongNamesColumnWidth) << std::left << "";
405 }
406
407 if(!desc.empty()) {
408 bool skipFirstLinePrefix = true;
409 if(out.str().length() > column_width_) {
410 out << '\n';
411 skipFirstLinePrefix = false;
412 }
413 detail::streamOutAsParagraph(
414 out, desc, right_column_width_, std::string(column_width_, ' '), skipFirstLinePrefix);
415 }
416 }
417
418 out << '\n';
419 return out.str();
420}
421
422CLI11_INLINE std::string Formatter::make_option_name(const Option *opt, bool is_positional) const {
423 if(is_positional)
424 return opt->get_name(true, false);
425
426 return opt->get_name(false, true, !enable_default_flag_values_);
427}
428
429CLI11_INLINE std::string Formatter::make_option_opts(const Option *opt) const {
430 std::stringstream out;
431 // Help output should be stable across runs, so sort pointer-based sets by option name before printing.
432 const auto print_option_set = [&out](const std::set<Option *> &options) {
433 std::vector<const Option *> sorted(options.begin(), options.end());
434 std::sort(sorted.begin(), sorted.end(), [](const Option *lhs, const Option *rhs) {
435 return lhs->get_name() < rhs->get_name();
436 });
437 for(const Option *op : sorted)
438 out << " " << op->get_name();
439 };
440
441 if(!opt->get_option_text().empty()) {
442 out << " " << opt->get_option_text();
443 } else {
444 if(opt->get_type_size() != 0) {
445 if(enable_option_type_names_) {
446 if(!opt->get_type_name().empty())
447 out << " " << get_label(opt->get_type_name());
448 }
450 if(!opt->get_default_str().empty())
451 out << " [" << opt->get_default_str() << "] ";
452 }
453 if(opt->get_expected_max() == detail::expected_max_vector_size)
454 out << " ...";
455 else if(opt->get_expected_min() > 1)
456 out << " x " << opt->get_expected();
457
458 if(opt->get_required())
459 out << " " << get_label("REQUIRED");
460 }
461 if(!opt->get_envname().empty())
462 out << " (" << get_label("Env") << ":" << opt->get_envname() << ")";
463 if(!opt->get_needs().empty()) {
464 out << " " << get_label("Needs") << ":";
465 print_option_set(opt->get_needs());
466 }
467 if(!opt->get_excludes().empty()) {
468 out << " " << get_label("Excludes") << ":";
469 print_option_set(opt->get_excludes());
470 }
471 }
472 return out.str();
473}
474
475CLI11_INLINE std::string Formatter::make_option_desc(const Option *opt) const { return opt->get_description(); }
476
477CLI11_INLINE std::string Formatter::make_option_usage(const Option *opt) const {
478 // Note that these are positionals usages
479 std::stringstream out;
480 out << make_option_name(opt, true);
481 if(opt->get_expected_max() >= detail::expected_max_vector_size)
482 out << "...";
483 else if(opt->get_expected_max() > 1)
484 out << "(" << opt->get_expected() << "x)";
485
486 return opt->get_required() ? out.str() : "[" + out.str() + "]";
487}
488// [CLI11:formatter_inl_hpp:end]
489} // namespace CLI
Creates a command line program, with very few defaults.
Definition App.hpp:115
CLI11_NODISCARD std::string get_footer() const
Generate and return the footer.
Definition App_inl.hpp:946
CLI11_NODISCARD std::size_t get_require_subcommand_max() const
Get the required max subcommand value.
Definition App.hpp:1098
CLI11_NODISCARD std::string get_usage() const
Generate and return the usage.
Definition App_inl.hpp:942
Option * get_help_ptr()
Get a pointer to the help flag.
Definition App.hpp:1152
CLI11_NODISCARD const Option * get_help_all_ptr() const
Get a pointer to the help all flag. (const).
Definition App.hpp:1158
App * get_parent()
Get the parent of this subcommand (or nullptr if main app).
Definition App.hpp:1173
CLI11_NODISCARD std::string get_display_name(bool with_aliases=false) const
Get a display name for an app.
Definition App_inl.hpp:1121
CLI11_NODISCARD std::size_t get_require_option_max() const
Get the required max option value.
Definition App.hpp:1104
CLI11_NODISCARD bool get_required() const
Get the status of required.
Definition App.hpp:1119
CLI11_NODISCARD std::vector< std::string > get_groups() const
Get the groups available directly from this option (in order).
Definition App_inl.hpp:1180
CLI11_NODISCARD const std::vector< std::string > & get_aliases() const
Get the aliases of the current app.
Definition App.hpp:1182
CLI11_NODISCARD std::size_t get_require_option_min() const
Get the required min option value.
Definition App.hpp:1101
CLI11_NODISCARD const std::string & get_group() const
Get the group of this subcommand.
Definition App.hpp:1086
CLI11_NODISCARD std::vector< App * > get_subcommands() const
Definition App.hpp:932
std::vector< const Option * > get_options(const std::function< bool(const Option *)> filter={}) const
Get the list of options (user facing function, so returns raw pointers), has optional filter function...
Definition App_inl.hpp:982
CLI11_NODISCARD std::string get_description() const
Get the app or subcommand description.
Definition App.hpp:1032
CLI11_NODISCARD std::size_t get_require_subcommand_min() const
Get the required min subcommand value.
Definition App.hpp:1095
CLI11_NODISCARD const std::string & get_name() const
Get the name of the current app.
Definition App.hpp:1179
std::size_t column_width_
The width of the left column (options/flags/subcommands).
Definition FormatterFwd.hpp:49
CLI11_NODISCARD std::string get_label(std::string key) const
Get the current value of a name (REQUIRED, etc.).
Definition Formatter_inl.hpp:50
std::map< std::string, std::string > labels_
The required help printout labels (user changeable) Values are Needs, Excludes, etc.
Definition FormatterFwd.hpp:73
std::size_t footer_paragraph_width_
The width of the footer paragraph.
Definition FormatterFwd.hpp:61
bool enable_option_defaults_
options controlling formatting of options
Definition FormatterFwd.hpp:68
static std::string default_label(const std::string &key)
Default user-facing help labels used when no override is set.
Definition FormatterFwd.hpp:76
void long_option_alignment_ratio(float ratio)
Definition Formatter_inl.hpp:45
CLI11_NODISCARD bool is_description_paragraph_formatting_enabled() const
Get the current status of description paragraph formatting.
Definition FormatterFwd.hpp:152
std::size_t right_column_width_
The width of the right column (description of options/flags/subcommands).
Definition FormatterFwd.hpp:55
float long_option_alignment_ratio_
The alignment ratio for long options within the left column.
Definition FormatterFwd.hpp:52
std::size_t description_paragraph_width_
The width of the description paragraph at the top of help.
Definition FormatterFwd.hpp:58
CLI11_NODISCARD bool is_footer_paragraph_formatting_enabled() const
Get the current status of whether footer paragraph formatting is enabled.
Definition FormatterFwd.hpp:155
std::string make_groups(const App *app, AppFormatMode mode) const
This prints out all the groups of options.
Definition Formatter_inl.hpp:83
virtual std::string make_usage(const App *app, std::string name) const
This displays the usage line.
Definition Formatter_inl.hpp:133
virtual std::string make_option_name(const Option *, bool) const
This is the name part of an option, Default: left column.
Definition Formatter_inl.hpp:422
virtual std::string make_expanded(const App *sub, AppFormatMode mode) const
This prints out a subcommand in help-all.
Definition Formatter_inl.hpp:291
std::string make_help(const App *app, std::string, AppFormatMode mode) const override
This puts everything together.
Definition Formatter_inl.hpp:193
virtual CLI11_NODISCARD std::string make_group(std::string group, bool is_positional, std::vector< const Option * > opts) const
Definition Formatter_inl.hpp:62
virtual std::string make_option(const Option *, bool) const
This prints out an option help line, either positional or optional form.
Definition Formatter_inl.hpp:331
virtual std::string make_footer(const App *app) const
This prints out all the groups of options.
Definition Formatter_inl.hpp:185
virtual std::string make_option_usage(const Option *opt) const
This is used to print the name on the USAGE line.
Definition Formatter_inl.hpp:477
virtual std::string make_subcommand(const App *sub) const
This prints out a subcommand.
Definition Formatter_inl.hpp:271
virtual std::string make_positionals(const App *app) const
This prints out just the positionals "group".
Definition Formatter_inl.hpp:73
virtual std::string make_subcommands(const App *app, AppFormatMode mode) const
This prints out all the subcommands.
Definition Formatter_inl.hpp:226
virtual std::string make_description(const App *app) const
This displays the description line.
Definition Formatter_inl.hpp:108
virtual std::string make_option_desc(const Option *) const
This is the description. Default: Right column, on new line if left column too large.
Definition Formatter_inl.hpp:475
virtual std::string make_option_opts(const Option *) const
This is the options part of the name, Default: combined into left column.
Definition Formatter_inl.hpp:429
FormatterLambda(funct_t funct)
Create a FormatterLambda with a lambda function.
Definition Formatter_inl.hpp:55
std::string make_help(const App *app, std::string name, AppFormatMode mode) const override
This will simply call the lambda function.
Definition Formatter_inl.hpp:57
CLI11_NODISCARD bool get_required() const
True if this is a required option.
Definition Option.hpp:139
CLI11_NODISCARD const std::string & get_group() const
Get the group of this option.
Definition Option.hpp:136
Definition Option.hpp:261
CLI11_NODISCARD bool get_positional() const
True if the argument can be given directly.
Definition Option.hpp:611
CLI11_NODISCARD std::string get_envname() const
The environment variable associated to this value.
Definition Option.hpp:567
CLI11_NODISCARD std::string get_type_name() const
Get the full typename for this option.
Definition Option_inl.hpp:599
CLI11_NODISCARD std::string get_name(bool positional=false, bool all_options=false, bool disable_default_flag_values=false) const
Gets a comma separated list of names. Will include / prefer the positional name if positional is true...
Definition Option_inl.hpp:294
CLI11_NODISCARD std::string get_default_str() const
The default value (for help printing).
Definition Option.hpp:576
CLI11_NODISCARD bool nonpositional() const
True if option has at least one non-positional name.
Definition Option.hpp:614
CLI11_NODISCARD std::set< Option * > get_excludes() const
The set of options excluded.
Definition Option.hpp:573
CLI11_NODISCARD std::set< Option * > get_needs() const
The set of options needed.
Definition Option.hpp:570
CLI11_NODISCARD const std::string & get_description() const
Get the description.
Definition Option.hpp:620
CLI11_NODISCARD int get_expected() const
The number of times the option expects to be included.
Definition Option.hpp:592
CLI11_NODISCARD int get_expected_min() const
The number of times the option expects to be included.
Definition Option.hpp:595
CLI11_NODISCARD int get_expected_max() const
The max number of times the option expects to be included.
Definition Option.hpp:597
CLI11_NODISCARD int get_type_size() const
The number of arguments the option expects.
Definition Option.hpp:556