Add --list-commands option to the snapshot command
[lttng-tools.git] / src / bin / lttng / utils.c
index 6041655ddda0f6eb42de5b829cb29688c11f1a24..e40c3fd708e3d4c3d18bfcc7a0e8be1b7ee89ea3 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "conf.h"
 #include "utils.h"
 
 #include "conf.h"
 #include "utils.h"
+#include "command.h"
 
 /*
  *  get_session_name
 
 /*
  *  get_session_name
@@ -56,6 +57,24 @@ error:
        return NULL;
 }
 
        return NULL;
 }
 
+/*
+ *  list_commands
+ *
+ *  List commands line by line. This is mostly for bash auto completion and to
+ *  avoid difficult parsing.
+ */
+void list_commands(struct cmd_struct *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];
+       }
+}
 
 /*
  * list_cmd_options
 
 /*
  * list_cmd_options
This page took 0.023144 seconds and 4 git commands to generate.