Commit 4b469af2bfa9bb4500926623849ca5f4b6939b42
Merge branch 'get_keys'
Showing
1 changed file
with
26 additions
and
0 deletions
src/cxxopts.hpp
| @@ -683,6 +683,12 @@ namespace cxxopts | @@ -683,6 +683,12 @@ namespace cxxopts | ||
| 683 | std::string | 683 | std::string |
| 684 | help(const std::vector<std::string>& groups = {""}) const; | 684 | help(const std::vector<std::string>& groups = {""}) const; |
| 685 | 685 | ||
| 686 | + const std::vector<std::string> | ||
| 687 | + groups() const; | ||
| 688 | + | ||
| 689 | + const HelpGroupDetails& | ||
| 690 | + group_help(const std::string& group) const; | ||
| 691 | + | ||
| 686 | private: | 692 | private: |
| 687 | 693 | ||
| 688 | inline | 694 | inline |
| @@ -1251,5 +1257,25 @@ Options::help(const std::vector<std::string>& groups) const | @@ -1251,5 +1257,25 @@ Options::help(const std::vector<std::string>& groups) const | ||
| 1251 | return toUTF8String(result); | 1257 | return toUTF8String(result); |
| 1252 | } | 1258 | } |
| 1253 | 1259 | ||
| 1260 | +const std::vector<std::string> | ||
| 1261 | +Options::groups() const | ||
| 1262 | +{ | ||
| 1263 | + std::vector<std::string> g; | ||
| 1264 | + | ||
| 1265 | + std::transform( | ||
| 1266 | + m_help.begin(), | ||
| 1267 | + m_help.end(), | ||
| 1268 | + std::back_inserter(g), | ||
| 1269 | + [](const std::map<std::string, HelpGroupDetails>::value_type& pair){return pair.first;}); | ||
| 1270 | + | ||
| 1271 | + return g; | ||
| 1272 | +} | ||
| 1273 | + | ||
| 1274 | +const HelpGroupDetails& | ||
| 1275 | +Options::group_help(const std::string& group) const | ||
| 1276 | +{ | ||
| 1277 | + return m_help.at(group); | ||
| 1278 | +} | ||
| 1279 | + | ||
| 1254 | } | 1280 | } |
| 1255 | #endif //CXX_OPTS_HPP | 1281 | #endif //CXX_OPTS_HPP |