Do not show prefix in output if there is no metadata.
Previously epubgrep would output “: match” instead of “match”. Closes: #15
This commit is contained in:
parent
b2a6f9217b
commit
18c3d8f58d
|
@ -78,22 +78,25 @@ void print_matches(const std::vector<search::match> &matches,
|
|||
{
|
||||
metadata.emplace_back("page " + match.page);
|
||||
}
|
||||
if (!opts.nocolor)
|
||||
if (!metadata.empty())
|
||||
{
|
||||
cout << termcolor::italic;
|
||||
}
|
||||
for (const auto &part : metadata)
|
||||
{
|
||||
cout << part;
|
||||
if (part != *(metadata.rbegin()))
|
||||
if (!opts.nocolor)
|
||||
{
|
||||
cout << ", ";
|
||||
cout << termcolor::italic;
|
||||
}
|
||||
for (const auto &part : metadata)
|
||||
{
|
||||
cout << part;
|
||||
if (part != *(metadata.rbegin()))
|
||||
{
|
||||
cout << ", ";
|
||||
}
|
||||
}
|
||||
cout << ": ";
|
||||
if (!opts.nocolor)
|
||||
{
|
||||
cout << termcolor::reset;
|
||||
}
|
||||
}
|
||||
cout << ": ";
|
||||
if (!opts.nocolor)
|
||||
{
|
||||
cout << termcolor::reset;
|
||||
}
|
||||
cout << match.context.first;
|
||||
if (!opts.nocolor)
|
||||
|
|
Loading…
Reference in New Issue
Block a user