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
2 files changed
tree: 589259df45d7ddf4e324689e69a737f3b28a5d49
  1. buildinfo/
  2. cmdline/
  3. dbutil/
  4. host/
  5. netconfig/
  6. netstate/
  7. textutil/
  8. toposort/
  9. vlog/
  10. .gitignore
  11. AUTHORS
  12. CONTRIBUTORS
  13. LICENSE
  14. PATENTS
  15. README.md
  16. VERSION
README.md

This repository contains general purpose libraries used by the Vanadium project.