Print all options at start.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2021-05-23 16:52:32 +02:00
parent f96f07caa7
commit 4b2fbecf93
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 20 additions and 7 deletions

View File

@ -28,6 +28,7 @@
#include <iostream>
#include <locale>
#include <string>
#include <typeinfo>
#include <vector>
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 &regex : vm["regexp"].as<std::vector<std::string>>())
if (opt.second.value().type() == typeid(std::vector<std::string>))
{
cout << "Searching for: " << regex << '\n';
for (const auto &str : opt.second.as<std::vector<std::string>>())
{
cout << opt.first << ": " << str << '\n';
}
}
else
{
auto second{opt.second.as<std::string>()};
if (second.empty())
{
cout << opt.first << ": true\n";
}
else
{
cout << opt.first << ": " << second << '\n';
}
}
}