Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -h/--help option to kiwix-serve #511

Merged
merged 1 commit into from
Dec 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/server/kiwix-serve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ void usage()
<< "\tZIM_PATH\t\tis the path of a ZIM file."
<< std::endl << std::endl

<< "Optional arguments:" << std::endl
<< "Optional arguments:" << std::endl << std::endl
<< "\t-h, --help\t\tprint this help" << std::endl << std::endl
<< "\t-a, --attachToProcess\texit if given process id is not running anymore" << std::endl
<< "\t-d, --daemon\t\tdetach the HTTP server daemon from the main process" << std::endl
<< "\t-i, --address\t\tlisten only on this ip address, all available ones otherwise" << std::endl
Expand Down Expand Up @@ -203,6 +204,7 @@ int main(int argc, char** argv)

static struct option long_options[]
= {{"daemon", no_argument, 0, 'd'},
{"help", no_argument, 0, 'h'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"library", no_argument, 0, 'l'},
Expand All @@ -223,10 +225,13 @@ int main(int argc, char** argv)
while (true) {
int option_index = 0;
int c
= getopt_long(argc, argv, "zmnbdvVla:p:f:t:r:i:c:M", long_options, &option_index);
= getopt_long(argc, argv, "hzmnbdvVla:p:f:t:r:i:c:M", long_options, &option_index);

if (c != -1) {
switch (c) {
case 'h':
usage();
return 0;
case 'd':
daemonFlag = true;
break;
Expand Down