Add --no-filename switch.
continuous-integration/drone/push Build is passing Details

Suppresses the mentioning of file names on output.
This commit is contained in:
tastytea 2021-05-26 09:04:16 +02:00
parent 9c307ab0fd
commit 694cb3bc44
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 28 additions and 11 deletions

View File

@ -2,7 +2,7 @@
:doctype: manpage
:Author: tastytea
:Email: tastytea@tastytea.de
:Date: 2021-05-25
:Date: 2021-05-26
:Revision: 0.0.0
:man source: epubgrep
:man manual: General Commands Manual
@ -58,6 +58,10 @@ Print _NUMBER_ words of context around matches.
*--nocolor*::
Do not color matches.
*--no-filename*::
Suppress the mentioning of file names on output. Chapters and page numbers will
still be output.
== USAGE
[source,shellsession]

View File

@ -115,11 +115,17 @@ int main(int argc, char *argv[])
for (const auto &match :
search::search(filepath, regex, opts))
{
cout << match.filepath;
if (vm.count("no-filename") == 0)
{
cout << match.filepath;
}
if (!match.headline.empty())
{
cout << ", " << match.headline;
if (vm.count("no-filename") == 0)
{
cout << ", ";
}
cout << match.headline;
}
if (!match.page.empty())
{

View File

@ -73,6 +73,9 @@ po::variables_map parse_options(int argc, char *argv[])
translate("Print NUMBER words of context around matches.")
.str().data())
("nocolor", translate("Do not color matches.") .str().data())
("no-filename",
translate("Suppress the mentioning of file names on output.")
.str().data())
;
po::options_description options_hidden("Hidden options");

View File

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: epubgrep 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-25 12:32+0200\n"
"PO-Revision-Date: 2021-05-25 12:32+0200\n"
"POT-Creation-Date: 2021-05-26 09:03+0200\n"
"PO-Revision-Date: 2021-05-26 09:03+0200\n"
"Last-Translator: tastytea <tastytea@tastytea.de>\n"
"Language-Team: tastytea <https://schlomp.space/tastytea/epubgrep>\n"
"Language: de\n"
@ -17,7 +17,7 @@ msgstr ""
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-SearchPath-0: .\n"
#: src/main.cpp:63 src/main.cpp:143
#: src/main.cpp:63 src/main.cpp:149
msgid "ERROR: "
msgstr "FEHLER: "
@ -25,7 +25,7 @@ msgstr "FEHLER: "
msgid "Error while parsing options."
msgstr "Fehler während Optionen interpretiert wurden."
#: src/main.cpp:144
#: src/main.cpp:150
msgid "Error while searching."
msgstr "Fehler während der Suche."
@ -85,11 +85,15 @@ msgstr "ANZAHL Wörter an Kontext um die Treffer herum ausgeben."
msgid "Do not color matches."
msgstr "Färbe die Treffer nicht ein."
#: src/options.cpp:116
#: src/options.cpp:77
msgid "Suppress the mentioning of file names on output."
msgstr "Unterdrücke die Erwähnung des Dateinamens in der Ausgabe."
#: src/options.cpp:119
msgid "Usage: epubgrep [OPTION]… PATTERN [FILE]…\n"
msgstr "Aufruf: epubgrep [OPTION]… MUSTER [DATEI]…\n"
#: src/options.cpp:118
#: src/options.cpp:121
msgid ""
"\n"
"You can access the full manual with `man epubgrep`.\n"
@ -97,7 +101,7 @@ msgstr ""
"\n"
"Du kannst mit `man epubgrep` auf das vollständige Handbuch zugreifen.\n"
#: src/options.cpp:125
#: src/options.cpp:128
msgid ""
"Copyright © 2021 tastytea <tastytea@tastytea.de>\n"
"License AGPL-3.0-only <https://gnu.org/licenses/agpl.html>.\n"