mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1051987 - By default, hide the disabled commands. They are eating the display for no value. $ ./mach -v help bring them back. r=jmaher
From 7c2de97792113d3415acf2cfa1591fa05c5b07a8 Mon Sep 17 00:00:00 2001 display for no value. $ ./mach -v help bring them back. --- build/mach_bootstrap.py | 2 +- python/mach/mach/dispatcher.py | 14 +++++++------- python/mach/mach/main.py | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-)
This commit is contained in:
parent
9090ec5069
commit
a82b0c1825
@ -119,7 +119,7 @@ CATEGORIES = {
|
||||
},
|
||||
'disabled': {
|
||||
'short': 'Disabled',
|
||||
'long': 'These commands are unavailable for your current context, run "mach <command>" to see why.',
|
||||
'long': 'The disabled commands are hidden by default. Use -v to display them. These commands are unavailable for your current context, run "mach <command>" to see why.',
|
||||
'priority': 0,
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class CommandAction(argparse.Action):
|
||||
"""
|
||||
if namespace.help:
|
||||
# -h or --help is in the global arguments.
|
||||
self._handle_main_help(parser)
|
||||
self._handle_main_help(parser, namespace.verbose)
|
||||
sys.exit(0)
|
||||
elif values:
|
||||
command = values[0].lower()
|
||||
@ -96,7 +96,7 @@ class CommandAction(argparse.Action):
|
||||
# Make sure args[0] is indeed a command.
|
||||
self._handle_subcommand_help(parser, args[0])
|
||||
else:
|
||||
self._handle_main_help(parser)
|
||||
self._handle_main_help(parser, namespace.verbose)
|
||||
sys.exit(0)
|
||||
elif '-h' in args or '--help' in args:
|
||||
# -h or --help is in the command arguments.
|
||||
@ -146,11 +146,10 @@ class CommandAction(argparse.Action):
|
||||
|
||||
command_namespace, extra = subparser.parse_known_args(args)
|
||||
setattr(namespace, 'command_args', command_namespace)
|
||||
|
||||
if extra:
|
||||
raise UnrecognizedArgumentError(command, extra)
|
||||
|
||||
def _handle_main_help(self, parser):
|
||||
def _handle_main_help(self, parser, verbose):
|
||||
# Since we don't need full sub-parser support for the main help output,
|
||||
# we create groups in the ArgumentParser and populate each group with
|
||||
# arguments corresponding to command names. This has the side-effect
|
||||
@ -197,9 +196,10 @@ class CommandAction(argparse.Action):
|
||||
if disabled_commands and 'disabled' in r.categories:
|
||||
title, description, _priority = r.categories['disabled']
|
||||
group = parser.add_argument_group(title, description)
|
||||
for c in disabled_commands:
|
||||
group.add_argument(c['command'], help=c['description'],
|
||||
action='store_true')
|
||||
if verbose == True:
|
||||
for c in disabled_commands:
|
||||
group.add_argument(c['command'], help=c['description'],
|
||||
action='store_true')
|
||||
|
||||
parser.print_help()
|
||||
|
||||
|
@ -595,6 +595,9 @@ To see more help for a specific command, run:
|
||||
action='store_true', default=False,
|
||||
help='Do not prefix log lines with times. By default, mach will '
|
||||
'prefix each output line with the time since command start.')
|
||||
global_group.add_argument('--show-disabled', dest='show_disabled',
|
||||
action='store_true', default=False,
|
||||
help='Hide the display of disabled options.')
|
||||
global_group.add_argument('-h', '--help', dest='help',
|
||||
action='store_true', default=False,
|
||||
help='Show this help message.')
|
||||
|
Loading…
Reference in New Issue
Block a user