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 <iostream>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <typeinfo>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -66,15 +67,27 @@ int main(int argc, char *argv[])
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "extended-regexp: " << vm.count("extended-regexp") << '\n';
|
// Print all options.
|
||||||
cout << "perl-regexp: " << vm.count("perl-regexp") << '\n';
|
for (const auto &opt : vm)
|
||||||
cout << "ignore-case: " << vm.count("ignore-case") << '\n';
|
|
||||||
|
|
||||||
if (vm.count("regexp") > 0)
|
|
||||||
{
|
{
|
||||||
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