From 4b2fbecf933008787ccb41beda928cb0f2543a2f Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 23 May 2021 16:52:32 +0200 Subject: [PATCH] Print all options at start. --- src/main.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1e20679..a296b1c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include int main(int argc, char *argv[]) @@ -66,15 +67,27 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } - cout << "extended-regexp: " << vm.count("extended-regexp") << '\n'; - cout << "perl-regexp: " << vm.count("perl-regexp") << '\n'; - cout << "ignore-case: " << vm.count("ignore-case") << '\n'; - - if (vm.count("regexp") > 0) + // Print all options. + for (const auto &opt : vm) { - for (const auto ®ex : vm["regexp"].as>()) + if (opt.second.value().type() == typeid(std::vector)) { - cout << "Searching for: " << regex << '\n'; + for (const auto &str : opt.second.as>()) + { + cout << opt.first << ": " << str << '\n'; + } + } + else + { + auto second{opt.second.as()}; + if (second.empty()) + { + cout << opt.first << ": true\n"; + } + else + { + cout << opt.first << ": " << second << '\n'; + } } }