nicer help

This commit is contained in:
john30
2015-02-01 13:06:42 +01:00
parent 0e8a669890
commit e15c66919a
+9 -4
View File
@@ -62,16 +62,20 @@ const char *argp_program_bug_address = ""PACKAGE_BUGREPORT"";
/** the documentation of the program. */ /** the documentation of the program. */
static const char argpdoc[] = static const char argpdoc[] =
"ebusctl - TCP socket client for "PACKAGE_STRING".\n\n" "Client for acessing "PACKAGE" via TCP.\n"
" hint: try 'help' for available ebusd commands.\n"; "\v"
"If given, send COMMAND together with CMDOPT options to "PACKAGE".\n"
"Use 'help' as COMMAND for help on available "PACKAGE" commands.";
/** the description of the accepted arguments. */ /** the description of the accepted arguments. */
static char argpargsdoc[] = "[CMD [CMDOPT]*]"; static char argpargsdoc[] = "\nCOMMAND [CMDOPT...]";
/** the definition of the known program arguments. */ /** the definition of the known program arguments. */
static const struct argp_option argpoptions[] = { static const struct argp_option argpoptions[] = {
{"server", 's', "HOST", 0, "Connect to HOST running "PACKAGE_STRING" (name or IP) [localhost]", 0 }, {NULL, 0, NULL, 0, "Options:", 1 },
{"server", 's', "HOST", 0, "Connect to HOST running "PACKAGE" (name or IP) [localhost]", 0 },
{"port", 'p', "PORT", 0, "Connect to PORT on HOST [8888]", 0 }, {"port", 'p', "PORT", 0, "Connect to PORT on HOST [8888]", 0 },
{NULL, 0, NULL, 0, NULL, 0 }, {NULL, 0, NULL, 0, NULL, 0 },
}; };
@@ -290,6 +294,7 @@ void connect(const char* host, int port, char* const *args, int argCount)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
struct argp argp = { argpoptions, parse_opt, argpargsdoc, argpdoc, NULL, NULL, NULL }; struct argp argp = { argpoptions, parse_opt, argpargsdoc, argpdoc, NULL, NULL, NULL };
setenv("ARGP_HELP_FMT", "no-dup-args-note", 0);
if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, NULL, &opt) != 0) if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, NULL, &opt) != 0)
return EINVAL; return EINVAL;