Only initialize search::options once.
This commit is contained in:
parent
af58d6e35a
commit
ce015954ea
54
src/main.cpp
54
src/main.cpp
|
@ -76,39 +76,39 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
search::options opts;
|
||||
if (vm.count("basic-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_kind::basic;
|
||||
}
|
||||
if (vm.count("extended-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_kind::extended;
|
||||
}
|
||||
if (vm.count("perl-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_kind::perl;
|
||||
}
|
||||
if (vm.count("grep") > 0)
|
||||
{
|
||||
opts.grep_like = true;
|
||||
}
|
||||
if (vm.count("ignore-case") > 0)
|
||||
{
|
||||
opts.ignore_case = true;
|
||||
}
|
||||
if (vm.count("raw") > 0)
|
||||
{
|
||||
opts.raw = true;
|
||||
}
|
||||
opts.context = vm["context"].as<std::uint64_t>();
|
||||
|
||||
for (const auto &filepath :
|
||||
vm["input-file"].as<std::vector<std::string>>())
|
||||
{
|
||||
for (const auto ®ex :
|
||||
vm["regexp"].as<std::vector<std::string>>())
|
||||
{
|
||||
search::options opts;
|
||||
if (vm.count("basic-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_kind::basic;
|
||||
}
|
||||
if (vm.count("extended-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_kind::extended;
|
||||
}
|
||||
if (vm.count("perl-regexp") > 0)
|
||||
{
|
||||
opts.regex = search::regex_kind::perl;
|
||||
}
|
||||
if (vm.count("grep") > 0)
|
||||
{
|
||||
opts.grep_like = true;
|
||||
}
|
||||
if (vm.count("ignore-case") > 0)
|
||||
{
|
||||
opts.ignore_case = true;
|
||||
}
|
||||
if (vm.count("raw") > 0)
|
||||
{
|
||||
opts.raw = true;
|
||||
}
|
||||
opts.context = vm["context"].as<std::uint64_t>();
|
||||
|
||||
try
|
||||
{
|
||||
for (const auto &match :
|
||||
|
|
Loading…
Reference in New Issue
Block a user