Add a '--list-options' option to each command.
[lttng-tools.git] / src / bin / lttng / commands / version.c
index c9b547bce2a2a844e6cd22e58e0a962a9ae8f7b0..f288ba4aa971e30e1e9c615f1f4dd629664b07ce 100644 (file)
 
 enum {
        OPT_HELP = 1,
+       OPT_LIST_OPTIONS,
 };
 
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
        {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
+       {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
        {0, 0, 0, 0, 0, 0, 0}
 };
 
@@ -46,6 +48,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "usage: lttng version\n");
        fprintf(ofp, "\n");
        fprintf(ofp, "  -h, --help               Show this help\n");
+       fprintf(ofp, "      --list-options       Simple listing of options\n");
        fprintf(ofp, "\n");
 }
 
@@ -66,6 +69,10 @@ int cmd_version(int argc, const char **argv)
                        usage(stderr);
                        ret = CMD_SUCCESS;
                        goto end;
+               case OPT_LIST_OPTIONS:
+                       list_cmd_options(stdout, long_options);
+                       ret = CMD_SUCCESS;
+                       goto end;
                default:
                        usage(stderr);
                        ret = CMD_UNDEFINED;
This page took 0.023542 seconds and 4 git commands to generate.