show help when calling without arguments

When calling nova without arguments you'll receive the following
output:

error: too few arguments
Try 'nova help ' for more information.

Changing 'and' to 'or' the help is also shown when calling nova
without arguments. I think that's the expected behavior.

Change-Id: Id14f0292ad00e6e45ad66dd010f449c3abbf3871
This commit is contained in:
Christian Berendt 2012-11-08 21:03:13 +01:00
parent a84300f020
commit 4ad512b50e
2 changed files with 7 additions and 13 deletions

View File

@ -356,7 +356,7 @@ class OpenStackComputeShell(object):
options.os_compute_api_version)
self.parser = subcommand_parser
if options.help and len(args) == 0:
if options.help or not argv:
subcommand_parser.print_help()
return 0

View File

@ -55,10 +55,9 @@ class ShellTest(utils.TestCase):
'(?m)^\s+root-password\s+Change the root password',
'(?m)^See "nova help COMMAND" for help on a specific command',
]
for argstr in ['--help', 'help']:
help_text = self.shell(argstr)
for r in required:
self.assertRegexpMatches(help_text, r)
help_text = self.shell('help')
for r in required:
self.assertRegexpMatches(help_text, r)
def test_help_on_subcommand(self):
required = [
@ -66,11 +65,6 @@ class ShellTest(utils.TestCase):
'(?m)^Change the root password',
'(?m)^Positional arguments:',
]
argstrings = [
'root-password --help',
'help root-password',
]
for argstr in argstrings:
help_text = self.shell(argstr)
for r in required:
self.assertRegexpMatches(help_text, r)
help_text = self.shell('help root-password')
for r in required:
self.assertRegexpMatches(help_text, r)