diff options
Diffstat (limited to 'src/support')
-rw-r--r-- | src/support/command-line.cpp | 12 | ||||
-rw-r--r-- | src/support/command-line.h | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/support/command-line.cpp b/src/support/command-line.cpp index d9b7170f5..c84474259 100644 --- a/src/support/command-line.cpp +++ b/src/support/command-line.cpp @@ -75,10 +75,16 @@ Options::Options(const std::string& command, const std::string& description) std::cout << "\n\nOptions:\n"; size_t optionWidth = 0; for (const auto& o : options) { + if (o.hidden) { + continue; + } optionWidth = std::max(optionWidth, o.longName.size() + o.shortName.size()); } for (const auto& o : options) { + if (o.hidden) { + continue; + } std::cout << '\n'; bool long_n_short = o.longName.size() != 0 && o.shortName.size() != 0; size_t pad = 1 + optionWidth - o.longName.size() - o.shortName.size(); @@ -106,8 +112,10 @@ Options& Options::add(const std::string& longName, const std::string& shortName, const std::string& description, Arguments arguments, - const Action& action) { - options.push_back({longName, shortName, description, arguments, action, 0}); + const Action& action, + bool hidden) { + options.push_back( + {longName, shortName, description, arguments, action, hidden, 0}); return *this; } diff --git a/src/support/command-line.h b/src/support/command-line.h index 99d98eec9..19b2546d9 100644 --- a/src/support/command-line.h +++ b/src/support/command-line.h @@ -57,7 +57,8 @@ public: const std::string& shortName, const std::string& description, Arguments arguments, - const Action& action); + const Action& action, + bool hidden = false); Options& add_positional(const std::string& name, Arguments arguments, const Action& action); @@ -70,6 +71,7 @@ private: std::string description; Arguments arguments; Action action; + bool hidden; size_t seen; }; std::vector<Option> options; |