Add unmatched arguments to example
Ref #242. Adds an example in the example file showing the unmatched arguments that are stored.
This commit is contained in:
parent
8185e6bb3a
commit
f0f465b20f
@ -173,6 +173,13 @@ parse(int argc, const char* argv[])
|
|||||||
|
|
||||||
auto arguments = result.arguments();
|
auto arguments = result.arguments();
|
||||||
std::cout << "Saw " << arguments.size() << " arguments" << std::endl;
|
std::cout << "Saw " << arguments.size() << " arguments" << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Unmatched options: ";
|
||||||
|
for (const auto& option: result.unmatched())
|
||||||
|
{
|
||||||
|
std::cout << "'" << option << "' ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
catch (const cxxopts::OptionException& e)
|
catch (const cxxopts::OptionException& e)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user