Define command short descriptions in configure.ac
[lttng-tools.git] / src / bin / lttng / lttng.c
index aa13bc45dd57f621e539b62d4e1aa6f401947767..b498539c76ea7847baafb177f23ee792f50fa901 100644 (file)
@@ -65,27 +65,29 @@ static struct option long_options[] = {
 
 /* First level command */
 static struct cmd_struct commands[] =  {
-       { "list", cmd_list},
-       { "status", cmd_status},
+       { "add-context", cmd_add_context},
+       { "calibrate", cmd_calibrate},
        { "create", cmd_create},
        { "destroy", cmd_destroy},
-       { "start", cmd_start},
-       { "stop", cmd_stop},
-       { "enable-event", cmd_enable_events},
+       { "disable-channel", cmd_disable_channels},
        { "disable-event", cmd_disable_events},
        { "enable-channel", cmd_enable_channels},
-       { "disable-channel", cmd_disable_channels},
-       { "add-context", cmd_add_context},
+       { "enable-event", cmd_enable_events},
+       { "help", NULL},
+       { "list", cmd_list},
+       { "load", cmd_load},
+       { "metadata", cmd_metadata},
+       { "save", cmd_save},
        { "set-session", cmd_set_session},
-       { "version", cmd_version},
-       { "calibrate", cmd_calibrate},
-       { "view", cmd_view},
        { "snapshot", cmd_snapshot},
-       { "save", cmd_save},
-       { "load", cmd_load},
+       { "start", cmd_start},
+       { "status", cmd_status},
+       { "stop", cmd_stop},
        { "track", cmd_track},
        { "untrack", cmd_untrack},
-       { "metadata", cmd_metadata},
+       { "help", NULL},
+       { "version", cmd_version},
+       { "view", cmd_view},
        { NULL, NULL}   /* Array closure */
 };
 
@@ -216,8 +218,14 @@ static int handle_command(int argc, char **argv)
                goto end;
        }
 
+       /* Special case for help command which needs the commands array */
+       if (strcmp(argv[0], "help") == 0) {
+               ret = cmd_help(argc, (const char**) argv, commands);
+               goto end;
+       }
+
        cmd = &commands[i];
-       while (cmd->func != NULL) {
+       while (cmd->name != NULL) {
                /* Find command */
                if (strcmp(argv[0], cmd->name) == 0) {
                        ret = cmd->func(argc, (const char**) argv);
This page took 0.025282 seconds and 5 git commands to generate.