Print all options at start.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f96f07caa7
commit
4b2fbecf93
27
src/main.cpp
27
src/main.cpp
|
@ -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 ®ex : 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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user