mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:14:54 +02:00
Fix --help all to display options without topic.
This commit is contained in:
+7
-4
@@ -324,7 +324,7 @@ class HelpfulArgumentParser(object):
|
||||
def __init__(self, args, plugins):
|
||||
self.args = args
|
||||
plugin_names = [name for name, _p in plugins.iteritems()]
|
||||
self.help_topics = HELP_TOPICS + plugin_names
|
||||
self.help_topics = HELP_TOPICS + plugin_names + [None]
|
||||
self.parser = configargparse.ArgParser(
|
||||
usage=SHORT_USAGE,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
@@ -375,9 +375,12 @@ class HelpfulArgumentParser(object):
|
||||
it, but can be None for `always documented'.
|
||||
|
||||
"""
|
||||
if topic is not None and self.visible_topics[topic]:
|
||||
group = self.groups[topic]
|
||||
group.add_argument(*args, **kwargs)
|
||||
if self.visible_topics[topic]:
|
||||
if topic in self.groups:
|
||||
group = self.groups[topic]
|
||||
group.add_argument(*args, **kwargs)
|
||||
else:
|
||||
self.parser.add_argument(*args, **kwargs)
|
||||
else:
|
||||
kwargs["help"] = argparse.SUPPRESS
|
||||
self.parser.add_argument(*args, **kwargs)
|
||||
|
||||
@@ -35,6 +35,7 @@ class CLITest(unittest.TestCase):
|
||||
|
||||
def test_help(self):
|
||||
self.assertRaises(SystemExit, self._call, ['--help'])
|
||||
self.assertRaises(SystemExit, self._call, ['--help all'])
|
||||
|
||||
def test_rollback(self):
|
||||
_, _, _, client = self._call(['rollback'])
|
||||
|
||||
Reference in New Issue
Block a user