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:
tastytea 2021-06-24 12:53:09 +02:00
parent b2a6f9217b
commit 18c3d8f58d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07

View File

@ -78,6 +78,8 @@ void print_matches(const std::vector<search::match> &matches,
{
metadata.emplace_back("page " + match.page);
}
if (!metadata.empty())
{
if (!opts.nocolor)
{
cout << termcolor::italic;
@ -95,6 +97,7 @@ void print_matches(const std::vector<search::match> &matches,
{
cout << termcolor::reset;
}
}
cout << match.context.first;
if (!opts.nocolor)
{