Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jarro2783/cxxopts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarryd Beck <jarro.2783@gmail.com>2022-05-02 23:21:12 +0300
committerJarryd Beck <jarro.2783@gmail.com>2022-05-02 23:21:12 +0300
commitf0f465b20f211048dd1c08293bde3de14dc1e4f4 (patch)
treec3bfc5da7379631eb85780cf93f57ef1ca0f9112
parent8185e6bb3a5d64717a5456903c71efc005ceb711 (diff)
Add unmatched arguments to example
Ref #242. Adds an example in the example file showing the unmatched arguments that are stored.
-rw-r--r--src/example.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/example.cpp b/src/example.cpp
index 420220e..b06d806 100644
--- a/src/example.cpp
+++ b/src/example.cpp
@@ -173,6 +173,13 @@ parse(int argc, const char* argv[])
auto arguments = result.arguments();
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)
{