Add --version option to kiwix-search

pull/326/head
Kelson 7 years ago
parent 4eb38869c1
commit 4aca5ff551

@ -21,6 +21,7 @@
#include <kiwix/reader.h> #include <kiwix/reader.h>
#include <kiwix/searcher.h> #include <kiwix/searcher.h>
#include "../version.h"
void usage() void usage()
{ {
@ -29,7 +30,8 @@ void usage()
<< " ZIM is the full path of the ZIM file." << endl << " ZIM is the full path of the ZIM file." << endl
<< " PATTERN is/are word(s) - or part of - to search in the ZIM." << endl << endl << " PATTERN is/are word(s) - or part of - to search in the ZIM." << endl << endl
<< " -s, --suggestion\tSuggest article titles based on the few letters of the PATTERN instead of making a fulltext search. Work a bit like a completion solution." << endl << " -s, --suggestion\tSuggest article titles based on the few letters of the PATTERN instead of making a fulltext search. Work a bit like a completion solution." << endl
<< " -v, --verbose\t\tGive details about the search process" << endl; << " -v, --verbose\t\tGive details about the search process" << endl
<< " -V, --version\t\tPrint software version" << endl;
exit(1); exit(1);
} }
@ -54,15 +56,19 @@ int main(int argc, char** argv)
static struct option long_options[] static struct option long_options[]
= {{"verbose", no_argument, 0, 'v'}, = {{"verbose", no_argument, 0, 'v'},
{"suggestion", no_argument, 0, 's'}, {"suggestion", no_argument, 0, 's'},
{"version", no_argument, 0, 'V'},
{0, 0, 0, 0}}; {0, 0, 0, 0}};
if (c != -1) { if (c != -1) {
c = getopt_long(argc, argv, "vsb:", long_options, &option_index); c = getopt_long(argc, argv, "Vvsb:", long_options, &option_index);
switch (c) { switch (c) {
case 'v': case 'v':
verboseFlag = true; verboseFlag = true;
break; break;
case 'V':
version();
return 0;
case 's': case 's':
suggestionFlag = true; suggestionFlag = true;
break; break;

Loading…
Cancel
Save