Add some getter
* Get list of groups * Get help details for groups
This commit is contained in:
parent
f4c429390f
commit
5492f17969
@ -683,6 +683,12 @@ namespace cxxopts
|
|||||||
std::string
|
std::string
|
||||||
help(const std::vector<std::string>& groups = {""}) const;
|
help(const std::vector<std::string>& groups = {""}) const;
|
||||||
|
|
||||||
|
const std::vector<std::string>
|
||||||
|
groups() const;
|
||||||
|
|
||||||
|
const HelpGroupDetails&
|
||||||
|
group_help(const std::string& group) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -1251,5 +1257,25 @@ Options::help(const std::vector<std::string>& groups) const
|
|||||||
return toUTF8String(result);
|
return toUTF8String(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<std::string>
|
||||||
|
Options::groups() const
|
||||||
|
{
|
||||||
|
std::vector<std::string> g;
|
||||||
|
|
||||||
|
std::transform(
|
||||||
|
m_help.begin(),
|
||||||
|
m_help.end(),
|
||||||
|
std::back_inserter(g),
|
||||||
|
[](const std::map<std::string, HelpGroupDetails>::value_type& pair){return pair.first;});
|
||||||
|
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HelpGroupDetails&
|
||||||
|
Options::group_help(const std::string& group) const
|
||||||
|
{
|
||||||
|
return m_help.at(group);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif //CXX_OPTS_HPP
|
#endif //CXX_OPTS_HPP
|
||||||
|
Loading…
Reference in New Issue
Block a user