#include <time.h>
#include <unistd.h>
-#include "../cmd.h"
-#include "../conf.h"
+#include "../command.h"
#include "../utils.h"
static char *opt_output_path;
enum {
OPT_HELP = 1,
+ OPT_LIST_OPTIONS,
};
static struct poptOption long_options[] = {
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
- {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
- {"output", 'o', POPT_ARG_STRING, &opt_output_path, 0, 0, 0},
+ {"help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL},
+ {"output", 'o', POPT_ARG_STRING, &opt_output_path, 0, NULL, NULL},
+ {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
{0, 0, 0, 0, 0, 0, 0}
};
fprintf(ofp, "usage: lttng create [options] [NAME]\n");
fprintf(ofp, "\n");
fprintf(ofp, " -h, --help Show this help\n");
+ fprintf(ofp, " --list-options Simple listing of options\n");
fprintf(ofp, " -o, --output PATH Specify output path for traces\n");
fprintf(ofp, "\n");
}
}
if (have_name) {
- ret = asprintf(&traces_path, "%s/" LTTNG_DEFAULT_TRACE_DIR_NAME
+ ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME
"/%s-%s", alloc_path, session_name, datetime);
} else {
- ret = asprintf(&traces_path, "%s/" LTTNG_DEFAULT_TRACE_DIR_NAME
+ ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME
"/%s", alloc_path, session_name);
}
}
/*
- * cmd_list
+ * cmd_create
*
- * The 'list <options>' first level command
+ * The 'create <options>' first level command
*/
int cmd_create(int argc, const char **argv)
{
case OPT_HELP:
usage(stderr);
goto end;
+ case OPT_LIST_OPTIONS:
+ list_cmd_options(stdout, long_options);
+ ret = CMD_SUCCESS;
+ goto end;
default:
usage(stderr);
ret = CMD_UNDEFINED;