summaryrefslogtreecommitdiff
path: root/cli/cli/runtime-inline.cxx
AgeCommit message (Collapse)AuthorFilesLines
2021-09-10Add multi-argument grouping support in group_scannerBoris Kolpackov1-1/+1
2021-08-03Add support for tracking argument/option positionBoris Kolpackov1-20/+43
The scanner interface now provides the position() function that returns a monotonically-increasing number which, if stored, can later be used to determine the relative position of the arguments. There is also now a parser implementation for std::pair<T, std::size_t> which parses the value T into the first half of the pair and stores the option position in the second half. Together, this can be used to establish the relative position of different options, for example: class options { std::vector<std::pair<std::uint64_t, std::size>> --config-id; std::vector<std::pair<std::string, std::size>> --config-name; }; cli::argv_scanner scan (argc, argv); options ops (scan); // Iterate over --config-id and --config-name options in the order // specified by the user. // auto ii (ops.config_id ().begin ()); auto ni (ops.config_name ().begin ()); for (size_t i (0), n (scan.position ()); i != n; ++i) { if (ii != ops.config_id ().end () && ii->second == i) { // Handle *ii. ++ii; } if (ni != ops.config_name ().end () && ni->second == i) { // Handle *ni. ++ni; } }
2020-04-27Separate tests and examples into individual packagesKaren Arutyunov1-0/+508
Also make cli module to be explicitly enabled via the config.cli configuration variable.