1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-06 07:03:52 +00:00

Keep original group order

This commit is contained in:
Lucas Czech 2018-04-12 08:36:55 +02:00 committed by Henry Schreiner
parent b17f7ce63a
commit fc8eef3ae1

View File

@ -904,11 +904,15 @@ class App {
// Check for options_ // Check for options_
bool npos = false; bool npos = false;
std::set<std::string> groups; std::vector<std::string> groups;
for(const Option_p &opt : options_) { for(const Option_p &opt : options_) {
if(opt->nonpositional()) { if(opt->nonpositional()) {
npos = true; npos = true;
groups.insert(opt->get_group());
// Add group if it is not already in there
if(std::find(groups.begin(), groups.end(), opt->get_group()) == groups.end()) {
groups.push_back(opt->get_group());
}
} }
} }