Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added help text to gapir. #2672

Merged
merged 1 commit into from
Mar 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion cmd/gapir/cc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,49 @@ struct Options {
const char* replayArchive = nullptr;
const char* postbackDirectory = "";
bool version = false;
bool help = false;

OnDiskCache onDiskCacheOptions;

static void PrintHelp() {
printf("gapir: gapir is a VM for the graphics api debugger system\n");
printf("Usage: gapir [args]\n");
printf("Args:\n");
printf(" --replay-archive string\n");
printf(" Path to an archive directory to replay, and then exit\n");
printf(" --postback-dir string\n");
printf(
" Path to a directory to use for outputs of the replay-archive\n");
printf(" --auth-token-file string\n");
printf(" Path to the a file containing the authentication token\n");
printf(" --enable-disk-cache\n");
printf(
" If set, then gapir will create and use a disk cache for "
"resources.\n");
printf(" --disk-cache-path string\n");
printf(" Path to a directory that will be used for the disk cache.\n");
printf(" If it contains an existing cache, that will be used\n");
printf(" If unset, the disk cache will default to a temp directory\n");
printf(" --cleanup-disk-cache\n");
printf(" If set, the disk cache will be deleted when gapir exits.\n");
printf(" --port int\n");
printf(" The port to use when listening for connections\n");
printf(" --log-level <F|E|W|I|D|V>\n");
printf(" Sets the log level for gapir.\n");
printf(" --log string\n");
printf(" Sets the path for the log file\n");
printf(" --idle-timeout-sec int\n");
printf(
" Timeout if gapir has not received communication from the server "
"(default infinity)\n");
printf(" --wait-for-debugger\n");
printf(
" Causes gapir to pause on init, and wait for a debugger to "
"connect\n");
printf(" -h,-help,--help\n");
printf(" Prints this elp text and exits.\n");
}

static Options Parse(int argc, const char* argv[]) {
Options opts;

Expand Down Expand Up @@ -528,6 +568,9 @@ struct Options {
opts.waitForDebugger = true;
} else if (strcmp(argv[i], "--version") == 0) {
opts.version = true;
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0 ||
strcmp(argv[i], "--help") == 0) {
opts.help = true;
} else {
GAPID_FATAL("Unknown argument: %s", argv[i]);
}
Expand Down Expand Up @@ -737,7 +780,10 @@ int main(int argc, const char* argv[]) {
GAPID_INFO("Waiting for debugger to attach");
core::Debugger::waitForAttach();
}
if (opts.version) {
if (opts.help) {
Options::PrintHelp();
return EXIT_SUCCESS;
} else if (opts.version) {
printf("GAPIR version " GAPID_VERSION_AND_BUILD "\n");
return EXIT_SUCCESS;
} else if (opts.mode == Options::kConflict) {
Expand Down