show help when calling without arguments
When calling cinder without arguments you'll receive the following output: error: too few arguments Try 'cinder help ' for more information. With this change the help is also shown when calling cinder without arguments. I think that's the expected behavior. Change-Id: I8f46f67b7fef472ac344bb74f80cf1b77c4c4745
This commit is contained in:
@@ -324,7 +324,7 @@ class OpenStackCinderShell(object):
|
||||
options.os_volume_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
|
||||
|
||||
|
||||
@@ -55,21 +55,15 @@ class ShellTest(utils.TestCase):
|
||||
'(?m)^\s+create\s+Add a new volume.',
|
||||
'(?m)^See "cinder 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 = [
|
||||
'^usage: cinder list',
|
||||
'(?m)^List all the volumes.',
|
||||
]
|
||||
argstrings = [
|
||||
'list --help',
|
||||
'help list',
|
||||
]
|
||||
for argstr in argstrings:
|
||||
help_text = self.shell(argstr)
|
||||
for r in required:
|
||||
self.assertRegexpMatches(help_text, r)
|
||||
help_text = self.shell('help list')
|
||||
for r in required:
|
||||
self.assertRegexpMatches(help_text, r)
|
||||
|
||||
Reference in New Issue
Block a user