Don't output empty fields.
This commit is contained in:
parent
972ce1d0fe
commit
8b21f4a8b9
15
src/main.cpp
15
src/main.cpp
@ -111,9 +111,18 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (const auto &match : search::search(filepath, regex, opts))
|
for (const auto &match : search::search(filepath, regex, opts))
|
||||||
{
|
{
|
||||||
cout << match.filepath << ", " << match.headline << ", "
|
cout << match.filepath;
|
||||||
<< match.page << ": " << match.context.first
|
if (!match.headline.empty())
|
||||||
<< match.text << match.context.second << '\n';
|
{
|
||||||
|
|
||||||
|
cout << ", " << match.headline;
|
||||||
|
}
|
||||||
|
if (!match.page.empty())
|
||||||
|
{
|
||||||
|
cout << ", " << match.page;
|
||||||
|
}
|
||||||
|
cout << ": " << match.context.first << match.text
|
||||||
|
<< match.context.second << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user