OPT_HELP = 1,
OPT_LIST_OPTIONS,
OPT_MAX_SIZE,
+ OPT_LIST_COMMANDS,
};
static struct poptOption snapshot_opts[] = {
{"name", 'n', POPT_ARG_STRING, &opt_output_name, 0, 0, 0},
{"max-size", 'm', POPT_ARG_STRING, 0, OPT_MAX_SIZE, 0, 0},
{"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
+ {"list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS},
{0, 0, 0, 0, 0, 0, 0}
};
case OPT_LIST_OPTIONS:
list_cmd_options(stdout, snapshot_opts);
goto end;
+ case OPT_LIST_COMMANDS:
+ list_commands(actions, stdout);
+ goto end;
case OPT_MAX_SIZE:
{
uint64_t val;
}
}
-/*
- * 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
*/
ret = 0;
goto end;
case OPT_DUMP_COMMANDS:
- list_commands(stdout);
+ list_commands(commands, stdout);
ret = 0;
goto end;
default:
#include "conf.h"
#include "utils.h"
+#include "command.h"
/*
* get_session_name
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
#include <popt.h>
+struct cmd_struct;
+
char *get_session_name(void);
+void list_commands(struct cmd_struct *commands, FILE *ofp);
void list_cmd_options(FILE *ofp, struct poptOption *options);
/*