static ColorOption color = COLOR_OPTION_AUTO;
-void
-apitrace_dump_usage(const char *argv0)
+static const char *synopsis = "Dump given trace(s) to standard output.";
+
+static void
+usage(void)
{
- std::cout << argv0 << " [OPTIONS] <trace-file>..."
- "\n\n\t"
- APITRACE_DUMP_SYNOPSIS
- "\n\n\t"
- "Supports the following options:\n\t"
- "\t--color=<WHEN>\n\t"
- "\t--colour=<WHEN> Colored syntax highlighting\n\t"
- "\t WHEN is 'auto', 'always', or 'never'\n";
+ std::cout
+ << "usage: apitrace dump [OPTIONS] <trace-file>...\n"
+ << synopsis << "\n"
+ "\n"
+ " --color=<WHEN>\n"
+ " --colour=<WHEN> Colored syntax highlighting\n"
+ " WHEN is 'auto', 'always', or 'never'\n";
}
-int
-apitrace_dump_command(int argc, char *argv[], int first_arg_command)
+static int
+command(int argc, char *argv[])
{
int i;
- for (i = first_arg_command; i < argc; ++i) {
+ for (i = 0; i < argc; ++i) {
const char *arg = argv[i];
if (arg[0] != '-') {
if (!strcmp(arg, "--")) {
break;
+ } else if (!strcmp(arg, "--help")) {
+ usage();
+ return 0;
} else if (!strcmp(arg, "--color=auto") ||
!strcmp(arg, "--colour=auto")) {
color = COLOR_OPTION_AUTO;
return 0;
}
+
+const Command dump_command = {
+ "dump",
+ synopsis,
+ usage,
+ command
+};