Add --list-commands option to the snapshot command
[lttng-tools.git] / src / bin / lttng / lttng.c
index c5198bda1b144784e1e42670458491d6fa22bec2..dc9dd9241b9847eb12466fefdefa8120314321ad 100644 (file)
@@ -75,6 +75,7 @@ static struct cmd_struct commands[] =  {
        { "version", cmd_version},
        { "calibrate", cmd_calibrate},
        { "view", cmd_view},
+       { "snapshot", cmd_snapshot},
        { "enable-consumer", cmd_enable_consumer}, /* OBSOLETE */
        { "disable-consumer", cmd_disable_consumer}, /* OBSOLETE */
        { NULL, NULL}   /* Array closure */
@@ -107,6 +108,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "    disable-event     Disable tracing event\n");
        fprintf(ofp, "    list              List possible tracing options\n");
        fprintf(ofp, "    set-session       Set current session name\n");
+       fprintf(ofp, "    snapshot          Snapshot buffers of current session name\n");
        fprintf(ofp, "    start             Start tracing\n");
        fprintf(ofp, "    stop              Stop tracing\n");
        fprintf(ofp, "    version           Show version information\n");
@@ -148,25 +150,6 @@ static void list_options(FILE *ofp)
        }
 }
 
-/*
- *  list_commands
- *
- *  List commands line by line. This is mostly for bash auto completion and to
- *  avoid difficult parsing.
- */
-static void list_commands(FILE *ofp)
-{
-       int i = 0;
-       struct cmd_struct *cmd = NULL;
-
-       cmd = &commands[i];
-       while (cmd->name != NULL) {
-               fprintf(ofp, "%s\n", cmd->name);
-               i++;
-               cmd = &commands[i];
-       }
-}
-
 /*
  * clean_exit
  */
@@ -464,7 +447,7 @@ static int parse_args(int argc, char **argv)
                        ret = 0;
                        goto end;
                case OPT_DUMP_COMMANDS:
-                       list_commands(stdout);
+                       list_commands(commands, stdout);
                        ret = 0;
                        goto end;
                default:
This page took 0.023895 seconds and 4 git commands to generate.