lttng: remove usage strings from commands
[lttng-tools.git] / src / bin / lttng / commands / load.c
index 150b880c0e833b839ee60b1e0abaeda723677090..d58cc07e0daa20853f59dcc411c670b936f70e04 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>
@@ -24,7 +24,7 @@
 #include <assert.h>
 
 #include <common/mi-lttng.h>
-#include <common/config/config.h>
+#include <common/config/session-config.h>
 
 #include "../command.h"
 
@@ -38,6 +38,7 @@ enum {
        OPT_HELP = 1,
        OPT_ALL,
        OPT_FORCE,
+       OPT_LIST_OPTIONS,
 };
 
 static struct mi_writer *writer;
@@ -48,27 +49,10 @@ static struct poptOption load_opts[] = {
        {"all",         'a',  POPT_ARG_NONE, 0, OPT_ALL, 0, 0},
        {"input-path",  'i',  POPT_ARG_STRING, &opt_input_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}
 };
 
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
-       fprintf(ofp, "usage: lttng load [OPTIONS] [SESSION]\n");
-       fprintf(ofp, "\n");
-       fprintf(ofp, "Options:\n");
-       fprintf(ofp, "  -h, --help               Show this help\n");
-       fprintf(ofp, "  -a, --all                Load all sessions (default)\n");
-       fprintf(ofp, "  -i, --input-path PATH    Input path of the session file(s).\n");
-       fprintf(ofp, "                           If a directory, load all files in it\n");
-       fprintf(ofp, "                           else try to load the given file.\n");
-       fprintf(ofp, "  -f, --force              Override existing session(s).\n");
-       fprintf(ofp, "                           This will destroy existing session(s)\n");
-       fprintf(ofp, "                           before creating new one(s).\n");
-}
-
 static int mi_partial_session(const char *session_name)
 {
        int ret;
@@ -149,16 +133,18 @@ int cmd_load(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_load_all = 1;
                        break;
+               case OPT_LIST_OPTIONS:
+                       list_cmd_options(stdout, load_opts);
+                       goto end;
                case OPT_FORCE:
                        opt_force = 1;
                        break;
                default:
-                       usage(stderr);
                        ret = CMD_UNDEFINED;
                        goto end;
                }
This page took 0.023666 seconds and 4 git commands to generate.