diff options
author | 2017-07-06 08:33:19 -0400 | |
---|---|---|
committer | 2017-07-06 12:56:27 +0000 | |
commit | 0933f339964a3bf2d878db51ac4c6119a5046c8b (patch) | |
tree | 7088ff9e9d5da9b29b1458aa02cde65a30e90dc8 | |
parent | bdf6c62a19c50822977387a1be084071f94768d4 (diff) |
output flags once
When asking for help on more than one item,
e.g. foo -h me -h oh -h my just print Flags:
once.
TBR=scroggo@google.com
Change-Id: I67080c7390e6bacf4c36096304dd959229fdd07b
Reviewed-on: https://skia-review.googlesource.com/21660
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
-rw-r--r-- | tools/flags/SkCommandLineFlags.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/flags/SkCommandLineFlags.cpp b/tools/flags/SkCommandLineFlags.cpp index bbbc397c2b..bfc9f5eebc 100644 --- a/tools/flags/SkCommandLineFlags.cpp +++ b/tools/flags/SkCommandLineFlags.cpp @@ -233,6 +233,7 @@ void SkCommandLineFlags::Parse(int argc, char** argv) { gOnce = true; bool helpPrinted = false; + bool flagsPrinted = false; // Loop over argv, starting with 1, since the first is just the name of the program. for (int i = 1; i < argc; i++) { if (0 == strcmp("-h", argv[i]) || 0 == strcmp("--help", argv[i])) { @@ -248,8 +249,10 @@ void SkCommandLineFlags::Parse(int argc, char** argv) { // Only print general help message if help for specific flags is not requested. SkDebugf("%s\n%s\n", argv[0], gUsage.c_str()); } - SkDebugf("Flags:\n"); - + if (!flagsPrinted) { + SkDebugf("Flags:\n"); + flagsPrinted = true; + } if (0 == helpFlags.count()) { // If no flags followed --help, print them all SkTDArray<SkFlagInfo*> allFlags; |