commit | ebb4a81ae3bcdcaba274b3b974d853f55eca372b | [log] [tgz] |
---|---|---|
author | Todd Wang <toddw@google.com> | Wed Apr 22 16:53:57 2015 -0700 |
committer | Todd Wang <toddw@google.com> | Wed Apr 22 16:53:57 2015 -0700 |
tree | 589259df45d7ddf4e324689e69a737f3b28a5d49 | |
parent | 7b796a3374f4cd2763f18c5b8f492969315c7ed5 [diff] |
lib: Add cmdline.HideGlobalFlagsExcept() to clean up help. Closes: veyron/release-issue#1905 ---------- Example of new output ---------- $ vrpc ERROR: vrpc: no command specified Command vrpc sends and receives Vanadium remote procedure calls. Usage: vrpc <command> The vrpc commands are: signature Describe the interfaces of a Vanadium server call Call a method of a Vanadium server identify Reveal blessings presented by a Vanadium server help Display help for commands or topics Run "vrpc help [command]" for command usage. Run "vrpc help -style=full" to show all global flags. ---------- This CL shortens the default cmdline usage output, so that you have a chance at seeing the important parts before it scrolls off the screen. The main culprit for long output is our long list of global flags. By default, nothing has changed; all global flags are shown in usage. Calling cmdline.HideGlobalFlagsExcept() causes the default behavior to hide global flags, except for the given regexps. This mechanism was chosen since it seems better to have global flags shown if the developer doesn't do anything special, but if they call the method it's easier to specify a whitelist than a blacklist. To show all global flags you use "help -style=full", or set the envvar CMDLINE_STYLE=full for root commands with no subcommands. When any global flags are hidden, the usage includes a line desribing the exact command to run to get the full output. The -style=godoc output always shows all global flags. MultiPart: 2/3 Change-Id: I2699a200e11ab948b7a9739a287738288acb1b14
This repository contains general purpose libraries used by the Vanadium project.