lttng: show man page when using command's --help
[lttng-tools.git] / src / bin / lttng / commands / save.c
index d90ae06344179d8013e398c59a2a4c57e00049d5..66ec5b6ebe904f5c2ec0ff33bb32598226b367ab 100644 (file)
@@ -15,7 +15,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
@@ -36,6 +36,7 @@ enum {
        OPT_HELP = 1,
        OPT_ALL,
        OPT_FORCE,
+       OPT_LIST_OPTIONS,
 };
 
 static struct poptOption save_opts[] = {
@@ -44,6 +45,7 @@ static struct poptOption save_opts[] = {
        {"all",         'a', POPT_ARG_NONE, 0, OPT_ALL, 0, 0},
        {"output-path", 'o', POPT_ARG_STRING, &opt_output_path, 0, 0, 0},
        {"force",       'f', POPT_ARG_NONE, 0, OPT_FORCE, 0, 0},
+       {"list-options",  0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
        {0, 0, 0, 0, 0, 0, 0}
 };
 
@@ -144,7 +146,7 @@ int cmd_save(int argc, const char **argv)
        while ((opt = poptGetNextOpt(pc)) != -1) {
                switch (opt) {
                case OPT_HELP:
-                       usage(stdout);
+                       SHOW_HELP();
                        goto end;
                case OPT_ALL:
                        opt_save_all = 1;
@@ -152,6 +154,9 @@ int cmd_save(int argc, const char **argv)
                case OPT_FORCE:
                        opt_force = 1;
                        break;
+               case OPT_LIST_OPTIONS:
+                       list_cmd_options(stdout, save_opts);
+                       goto end;
                default:
                        usage(stderr);
                        ret = CMD_UNDEFINED;
This page took 0.0238 seconds and 4 git commands to generate.