Improve help messages for cros_workon
BUG=None
TEST=cros_workon info --help gives the description of the command now.
Change-Id: Ia79530e9930b3c9dc4bb58d7ad4cae08031d01d0
Reviewed-on: https://chromium-review.googlesource.com/270501
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
diff --git a/scripts/cros_workon.py b/scripts/cros_workon.py
index 22e03fc..087c0a8 100644
--- a/scripts/cros_workon.py
+++ b/scripts/cros_workon.py
@@ -8,15 +8,6 @@
last known good commit. Moving an ebuild to 'live' (via cros_workon start)
is intended to support development. The current source tip is fetched,
source modified and built using the unstable 'live' (9999) ebuild.
-
-commands:
- start: Moves an ebuild to live (intended to support development)
- stop: Moves an ebuild to stable (use last known good)
- info: Print package name, repo name, and source directory.
- list: List of live ebuilds (workon ebuilds if --all)
- list-all: List all of the live ebuilds for all setup boards
- iterate: For each ebuild, cd to the source dir and run a command"
-
"""
from __future__ import print_function
@@ -55,25 +46,18 @@
shared.add_argument('packages', nargs='*',
help='The packages to run command against.')
- commands = parser.add_subparsers(dest='command', title='commands')
- commands.add_parser(
- 'start', parents=[shared,],
- help='Moves an ebuild to live (intended to support development)')
- commands.add_parser(
- 'stop', parents=[shared,],
- help='Moves an ebuild to stable (use last known good)')
- commands.add_parser(
- 'info', parents=[shared,],
- help='Print package name, repo name, and source directory.')
- commands.add_parser(
- 'list', parents=[shared,],
- help='List of live ebuilds (workon ebuilds if --all)')
- commands.add_parser(
- 'list-all', parents=[shared,],
- help='List all of the live ebuilds for all setup boards')
- commands.add_parser(
- 'iterate', parents=[shared,],
- help='For each ebuild, cd to the source dir and run a command')
+ commands = [
+ ('start', 'Moves an ebuild to live (intended to support development)'),
+ ('stop', 'Moves an ebuild to stable (use last known good)'),
+ ('info', 'Print package name, repo name, and source directory.'),
+ ('list', 'List of live ebuilds (workon ebuilds if --all)'),
+ ('list-all', 'List all of the live ebuilds for all setup boards'),
+ ('iterate', 'For each ebuild, cd to the source dir and run a command'),
+ ]
+ command_parsers = parser.add_subparsers(dest='command', title='commands')
+ for command, description in commands:
+ command_parsers.add_parser(command, parents=(shared,), help=description,
+ description=description)
options = parser.parse_args(argv)
options.Freeze()