Put input files into a std::vector<filesystem::path>.
We need that for supporting recursive directory search later. # # Previous commits: #29ae22c
Make regex const. #8ed72af
Update german translation. #a3b0964
Remove old comment. #d107ce5
Modify config file example.
This commit is contained in:
parent
29ae22cc4a
commit
b764f5423c
|
@ -78,12 +78,17 @@ int main(int argc, char *argv[])
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<fs::path> input_files;
|
||||||
if (vm.count("input-file") == 0)
|
if (vm.count("input-file") == 0)
|
||||||
{
|
{
|
||||||
cout << "NO INPUT FILE\n";
|
cout << "NO INPUT FILE\n";
|
||||||
// TODO: Read data from stdin.
|
// TODO: Read data from stdin.
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
for (const auto &filepath : vm["input-file"].as<vector<string>>())
|
||||||
|
{
|
||||||
|
input_files.emplace_back(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
int return_code{EXIT_SUCCESS};
|
int return_code{EXIT_SUCCESS};
|
||||||
|
|
||||||
|
@ -118,7 +123,7 @@ int main(int argc, char *argv[])
|
||||||
vector<std::future<int>> futurepool;
|
vector<std::future<int>> futurepool;
|
||||||
|
|
||||||
auto search_file{
|
auto search_file{
|
||||||
[&vm, &matches_all, &opts](std::string_view filepath)
|
[&vm, &matches_all, &opts](fs::path filepath)
|
||||||
{
|
{
|
||||||
for (const auto ®ex : vm["regexp"].as<vector<string>>())
|
for (const auto ®ex : vm["regexp"].as<vector<string>>())
|
||||||
{
|
{
|
||||||
|
@ -172,7 +177,7 @@ int main(int argc, char *argv[])
|
||||||
return static_cast<std::uint32_t>(std::ceil(n / 2 + n / 4));
|
return static_cast<std::uint32_t>(std::ceil(n / 2 + n / 4));
|
||||||
}()};
|
}()};
|
||||||
|
|
||||||
for (const auto &filepath : vm["input-file"].as<vector<string>>())
|
for (const auto &filepath : input_files)
|
||||||
{
|
{
|
||||||
if (futurepool.size() >= max_threads)
|
if (futurepool.size() >= max_threads)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user