mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1043524 - Define group variable is an existing parser is passed; r=jgraham
While I was here, I removed the try..except in favor of failing fast. Before, we were only making cosmetic changes. Now, we actually need the group for mach to work. It makes sense to stop ignoring errors. This fixes a regression from d53d1c6cdf13 / bug 951733. --HG-- extra : rebase_source : aeb6c99a945eaff32cf86fa481d03c0c8dee593a extra : amend_source : f1e29385bf8ca8ac250a04f81e7e955c4152b476
This commit is contained in:
parent
ee66ee1a0b
commit
804eecce0c
@ -230,16 +230,17 @@ class CommandAction(argparse.Action):
|
||||
if handler.parser:
|
||||
c_parser = handler.parser
|
||||
c_parser.formatter_class = NoUsageFormatter
|
||||
try:
|
||||
# By default argparse adds two groups called "positional arguments"
|
||||
# and "optional arguments". We want to rename these to reflect standard
|
||||
# mach terminology.
|
||||
c_parser._action_groups[0].title = 'Command Parameters'
|
||||
c_parser._action_groups[1].title = 'Command Arguments'
|
||||
except:
|
||||
# If argparse changes the internal data structures here continue;
|
||||
# this will just make the output more ugly
|
||||
pass
|
||||
# Accessing _action_groups is a bit shady. We are highly dependent
|
||||
# on the argparse implementation not changing. We fail fast to
|
||||
# detect upstream changes so we can intelligently react to them.
|
||||
group = c_parser._action_groups[1]
|
||||
|
||||
# By default argparse adds two groups called "positional arguments"
|
||||
# and "optional arguments". We want to rename these to reflect standard
|
||||
# mach terminology.
|
||||
c_parser._action_groups[0].title = 'Command Parameters'
|
||||
c_parser._action_groups[1].title = 'Command Arguments'
|
||||
|
||||
if not handler.description:
|
||||
handler.description = c_parser.description
|
||||
c_parser.description = None
|
||||
|
Loading…
Reference in New Issue
Block a user