Skip to content

Commit

Permalink
Re-order cli options
Browse files Browse the repository at this point in the history
I think it is more intuitive this way.
And help/short_options/long_options are in sync.
  • Loading branch information
moschlar committed Oct 15, 2019
1 parent f2562f3 commit e7a3001
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,29 @@ void do_help(int argc, char *argv[]) {
printf(" -h,--help\n");
printf(" -c,--config-dir=<ccnet_conf_dir>\tSet configuration directory\n");
printf(" -d,--data-dir=<seafile_data_dir>\tSet data directory\n");
printf(" -K,--stop\tStop a running instance of the Seafile Client\n");
printf(" --stdout\tSend logging output to standard output instead of logfile\n");
printf(" -D,--delay\tWait one second before doing anything else\n");
printf(" -P,--ping\tSend Ping to running instance of the Seafile Client, which should respond with Pong\n");
printf(" -K,--stop\tStop a running instance of the Seafile Client\n");
printf(" -X,--remove-user-data\tRemove all user configuration data\n");
printf(" -f,--open-local-file=<url>\tOpen a file from a Seafile library locally (used by \"Open via Client\" in Seahub)\n");
printf(" --stdout\tSend logging output to standard output instead of logfile\n");
printf(" -P,--ping\tSend Ping to running instance of the Seafile Client, which should respond with Pong\n");
}

void handleCommandLineOption(int argc, char *argv[])
{
int c;
static const char *short_options = "VhKDXPc:d:f:";
static const char *short_options = "Vhc:d:DPKXf:";
static const struct option long_options[] = {
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{ "config-dir", required_argument, NULL, 'c' },
{ "data-dir", required_argument, NULL, 'd' },
{ "stop", no_argument, NULL, 'K' },
{ "stdout", no_argument, NULL, 'l' },
{ "delay", no_argument, NULL, 'D' },
{ "ping", no_argument, NULL, 'P' },
{ "stop", no_argument, NULL, 'K' },
{ "remove-user-data", no_argument, NULL, 'X' },
{ "open-local-file", required_argument, NULL, 'f' },
{ "stdout", no_argument, NULL, 'l' },
{ "ping", no_argument, NULL, 'P' },
{ NULL, 0, NULL, 0, },
};

Expand All @@ -153,15 +153,15 @@ void handleCommandLineOption(int argc, char *argv[])
case 'l':
g_setenv ("LOG_STDOUT", "", 1);
break;
case 'K':
do_stop();
exit(0);
case 'P':
do_ping();
exit(0);
case 'D':
msleep(1000);
break;
case 'P':
do_ping();
exit(0);
case 'K':
do_stop();
exit(0);
case 'X':
do_remove_user_data();
exit(0);
Expand Down

0 comments on commit e7a3001

Please sign in to comment.