Commit da89488c authored by Mathieu Giraud's avatar Mathieu Giraud

lib/CLI11.hpp: -> level()

Some options will be not always displayed in the help message.
parent 9ac8c70b
......@@ -790,6 +790,9 @@ class Option {
/// True if this is a required option
bool required_{false};
/// >= 2 if this is an advanced option
int help_level_{1};
/// The number of expected values, 0 for flag, -1 for unlimited vector
int expected_{1};
......@@ -863,6 +866,12 @@ class Option {
return this;
}
/// Set the help level
Option *level(int value = 2) {
help_level_ = value;
return this;
}
/// Support Plubmum term
Option *mandatory(bool value = true) { return required(value); }
......@@ -1895,7 +1904,7 @@ class App {
}
/// Makes a help message, with a column wid for column 1
std::string help(size_t wid = 30, std::string prev = "") const {
std::string help(size_t wid = 30, std::string prev = "", int help_level = 1) const {
// Delegate to subcommand if needed
if(prev == "")
prev = name_;
......@@ -1963,7 +1972,7 @@ class App {
continue;
out << group << ":" << std::endl;
for(const Option_p &opt : options_) {
if(opt->nonpositional() && opt->get_group() == group)
if(opt->nonpositional() && opt->get_group() == group && opt->help_level_ <= help_level)
detail::format_help(out, opt->help_name(), opt->get_description(), wid);
}
out << std::endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment