print_matches(): Don't check file name for each match.
We only process one file at a time.
This commit is contained in:
parent
7b817c42d1
commit
8b5c0d289e
|
@ -37,27 +37,22 @@ using std::cout;
|
|||
void print_matches(const std::vector<search::match> &matches,
|
||||
const options::options &opts, bool single_file)
|
||||
{
|
||||
fs::path last_epub;
|
||||
if (!single_file && !opts.no_fn_fs)
|
||||
{
|
||||
if (!opts.nocolor)
|
||||
{
|
||||
cout << termcolor::yellow;
|
||||
}
|
||||
cout << format(translate(" In {0:s}: \n").str(),
|
||||
fs::relative(matches[0].filepath_epub));
|
||||
if (!opts.nocolor)
|
||||
{
|
||||
cout << termcolor::reset;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &match : matches)
|
||||
{
|
||||
if (!single_file && !opts.no_fn_fs)
|
||||
{
|
||||
if (match.filepath_epub != last_epub)
|
||||
{
|
||||
if (!opts.nocolor)
|
||||
{
|
||||
cout << termcolor::yellow;
|
||||
}
|
||||
cout << format(translate(" In {0:s}: \n").str(),
|
||||
fs::relative(match.filepath_epub));
|
||||
last_epub = match.filepath_epub;
|
||||
if (!opts.nocolor)
|
||||
{
|
||||
cout << termcolor::reset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> metadata;
|
||||
if (!opts.no_fn_epub)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
namespace epubgrep::output
|
||||
{
|
||||
|
||||
// Print the matches of an EPUB.
|
||||
void print_matches(const std::vector<search::match> &matches,
|
||||
const options::options &opts, bool single_file);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user