mirror of
https://github.com/certbot/certbot.git
synced 2026-06-07 07:42:08 -04:00
Alternate help syntax - issue 3371 (#4068)
* [#3371] support for new help syntax + tests * [#3371] splitting up test to satisfy linter
This commit is contained in:
parent
a5101d73a0
commit
0fa307806e
2 changed files with 24 additions and 0 deletions
|
|
@ -432,6 +432,10 @@ class HelpfulArgumentParser(object):
|
|||
|
||||
self.detect_defaults = detect_defaults
|
||||
self.args = args
|
||||
|
||||
if self.args[0] == 'help':
|
||||
self.args[0] = '--help'
|
||||
|
||||
self.determine_verb()
|
||||
help1 = self.prescan_for_flag("-h", self.help_topics)
|
||||
help2 = self.prescan_for_flag("--help", self.help_topics)
|
||||
|
|
|
|||
|
|
@ -131,6 +131,26 @@ class ParseTest(unittest.TestCase):
|
|||
self.assertTrue("%s" not in out)
|
||||
self.assertTrue("{0}" not in out)
|
||||
|
||||
def test_help_no_dashes(self):
|
||||
self._help_output(['help']) # assert SystemExit is raised here
|
||||
|
||||
out = self._help_output(['help', 'all'])
|
||||
self.assertTrue("--configurator" in out)
|
||||
self.assertTrue("how a cert is deployed" in out)
|
||||
self.assertTrue("--webroot-path" in out)
|
||||
self.assertTrue("--text" not in out)
|
||||
self.assertTrue("--dialog" not in out)
|
||||
self.assertTrue("%s" not in out)
|
||||
self.assertTrue("{0}" not in out)
|
||||
|
||||
out = self._help_output(['help', 'install'])
|
||||
self.assertTrue("--cert-path" in out)
|
||||
self.assertTrue("--key-path" in out)
|
||||
|
||||
out = self._help_output(['help', 'revoke'])
|
||||
self.assertTrue("--cert-path" in out)
|
||||
self.assertTrue("--key-path" in out)
|
||||
|
||||
def test_parse_domains(self):
|
||||
short_args = ['-d', 'example.com']
|
||||
namespace = self.parse(short_args)
|
||||
|
|
|
|||
Loading…
Reference in a new issue