/* Getopt options. No first level command. */
static struct option long_options[] = {
+ {"version", 0, NULL, 'V'},
{"help", 0, NULL, 'h'},
{"group", 1, NULL, 'g'},
{"verbose", 0, NULL, 'v'},
{ "version", cmd_version},
{ "calibrate", cmd_calibrate},
{ "view", cmd_view},
- { "enable-consumer", cmd_enable_consumer}, /* OBSELETE */
- { "disable-consumer", cmd_disable_consumer}, /*OBSELETE */
+ { "snapshot", cmd_snapshot},
+ { "enable-consumer", cmd_enable_consumer}, /* OBSOLETE */
+ { "disable-consumer", cmd_disable_consumer}, /* OBSOLETE */
{ NULL, NULL} /* Array closure */
};
fprintf(ofp, "usage: lttng [OPTIONS] <COMMAND> [<ARGS>]\n");
fprintf(ofp, "\n");
fprintf(ofp, "Options:\n");
+ fprintf(ofp, " -V, --version Show version\n");
fprintf(ofp, " -h, --help Show this help\n");
fprintf(ofp, " --list-options Simple listing of lttng options\n");
fprintf(ofp, " --list-commands Simple listing of lttng commands\n");
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");
fprintf(ofp, "See http://lttng.org for updates, bug reports and news.\n");
}
+static void version(FILE *ofp)
+{
+ fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME"\n",
+ progname);
+}
+
/*
* list_options
*
}
/* Command not found */
- ret = -1;
+ ret = CMD_UNDEFINED;
end:
return ret;
clean_exit(EXIT_FAILURE);
}
- while ((opt = getopt_long(argc, argv, "+hnvqg:", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "+Vhnvqg:", long_options, NULL)) != -1) {
switch (opt) {
+ case 'V':
+ version(stdout);
+ ret = 0;
+ goto end;
case 'h':
usage(stdout);
ret = 0;
case CMD_FATAL:
ERR("Fatal error");
break;
+ case CMD_UNSUPPORTED:
+ ERR("Unsupported command");
+ break;
case -1:
usage(stderr);
ret = 1;