Add --version option to kiwix-read

This commit is contained in:
Kelson 2019-08-25 18:19:17 +02:00
parent 4aca5ff551
commit 93116c76b3

View File

@ -22,9 +22,11 @@
#include <map> #include <map>
#include <string> #include <string>
#include "../version.h"
void usage() void usage()
{ {
cout << "Usage: kiwix-read --suggest=<PATTERN> ZIM_FILE_PATH" << endl; cout << "Usage: kiwix-read [--verbose] [--version] --suggest=<PATTERN> ZIM_FILE_PATH" << endl;
exit(1); exit(1);
} }
@ -42,15 +44,19 @@ int main(int argc, char** argv)
while (42) { while (42) {
static struct option long_options[] static struct option long_options[]
= {{"verbose", no_argument, 0, 'v'}, = {{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"suggest", required_argument, 0, 's'}, {"suggest", required_argument, 0, 's'},
{0, 0, 0, 0}}; {0, 0, 0, 0}};
if (c != -1) { if (c != -1) {
c = getopt_long(argc, argv, "vs:", long_options, &option_index); c = getopt_long(argc, argv, "Vvs:", long_options, &option_index);
switch (c) { switch (c) {
case 'v': case 'v':
break; break;
case 'V':
version();
return 0;
case 's': case 's':
pattern = optarg; pattern = optarg;
break; break;