Allow hiding command line arguments from Usage()

Add wxCMD_LINE_HIDDEN wxCmdLineParser flag allowing to hide options and/or
parameters.

A hidden/unlisted argument is processed as usual, but not shown in the output
given by Usage(). A use case for such could be diagnostics switches that
should exist but are not useful to the end user.

Closes https://github.com/wxWidgets/wxWidgets/pull/390
This commit is contained in:
Lauri Nurmi
2017-01-09 16:28:40 +02:00
committed by Vadim Zeitlin
parent d15bbcacd2
commit b8192cb8e1
5 changed files with 23 additions and 2 deletions

View File

@@ -41,6 +41,8 @@ static const wxCmdLineEntryDesc cmdLineDesc[] =
{ wxCMD_LINE_SWITCH, "h", "help", "show this help message",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
{ wxCMD_LINE_SWITCH, "d", "dummy", "a dummy switch" },
{ wxCMD_LINE_SWITCH, "s", "secret", "a secret switch",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_HIDDEN },
// ... your other command line options here...
{ wxCMD_LINE_NONE }
@@ -96,6 +98,11 @@ int main(int argc, char **argv)
wxPrintf("Bad luck!\n");
}
}
if (parser.Found("s"))
{
wxPrintf("Secret switch was given...\n");
}
break;
default: