diff options
author | Jarryd Beck <jarro.2783@gmail.com> | 2022-05-02 23:21:12 +0300 |
---|---|---|
committer | Jarryd Beck <jarro.2783@gmail.com> | 2022-05-02 23:21:12 +0300 |
commit | f0f465b20f211048dd1c08293bde3de14dc1e4f4 (patch) | |
tree | c3bfc5da7379631eb85780cf93f57ef1ca0f9112 | |
parent | 8185e6bb3a5d64717a5456903c71efc005ceb711 (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.cpp | 7 |
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) { |