From e04b9355995d5c6120d8c51911b465c161118533 Mon Sep 17 00:00:00 2001 From: David Neto Date: Thu, 17 Mar 2016 14:04:32 -0400 Subject: [PATCH] Support both -h, --help on spirv-as, spirv-val The spirv-dis command already supports both. --- tools/as/as.cpp | 6 +++++- tools/val/val.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/as/as.cpp b/tools/as/as.cpp index 10a7821..8166d76 100644 --- a/tools/as/as.cpp +++ b/tools/as/as.cpp @@ -44,7 +44,7 @@ is used. Options: - -h Print this help. + -h, --help Print this help. -o Set the output filename. Use '-' to mean stdout. --version Display assembler version information. @@ -92,6 +92,10 @@ int main(int argc, char** argv) { SPV_SPIRV_VERSION_MINOR, SPV_SPIRV_VERSION_REVISION); return 0; } + if (0 == strcmp(argv[argi], "--help")) { + print_usage(argv[0]); + return 0; + } } break; default: print_usage(argv[0]); diff --git a/tools/val/val.cpp b/tools/val/val.cpp index a169bbd..76220fa 100644 --- a/tools/val/val.cpp +++ b/tools/val/val.cpp @@ -44,7 +44,8 @@ or if the filename is "-", then the binary is read from standard input. NOTE: The validator is a work in progress. Options: - --version Display validator version information + -h, --help Print this help. + --version Display validator version information. )", argv0, argv0); } @@ -64,6 +65,9 @@ int main(int argc, char** argv) { printf("Target: SPIR-V %d.%d rev %d\n", SPV_SPIRV_VERSION_MAJOR, SPV_SPIRV_VERSION_MINOR, SPV_SPIRV_VERSION_REVISION); return 0; + } else if (0 == strcmp(cur_arg, "--help") || 0 == strcmp(cur_arg, "-h")) { + print_usage(argv[0]); + return 0; } else if (0 == cur_arg[1]) { // Setting a filename of "-" to indicate stdin. if (!inFile) { -- 2.7.4