Skip to content

Commit

Permalink
[FEATURE] recursive subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Sep 19, 2024
1 parent 7534545 commit 1f64772
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/sharg/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,19 @@ class parser

operations.push_back(std::move(operation));
}

/*!\brief Adds subcommands to the parser.
* \param[in] subcommands A list of subcommands.
*/
void add_subcommands(std::vector<std::string> const & subcommands)
{
auto & parser_subcommands = this->subcommands;
parser_subcommands.insert(parser_subcommands.end(), subcommands.cbegin(), subcommands.cend());

std::ranges::sort(parser_subcommands);
auto const [first, last] = std::ranges::unique(parser_subcommands);
parser_subcommands.erase(first, last);
}
//!\}

/*!\brief Aggregates all parser related meta data (see sharg::parser_meta_data struct).
Expand Down

0 comments on commit 1f64772

Please sign in to comment.