]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Make 'heat help' show a list of commands
authorZane Bitter <zbitter@redhat.com>
Mon, 14 May 2012 15:56:33 +0000 (17:56 +0200)
committerZane Bitter <zbitter@redhat.com>
Mon, 14 May 2012 17:25:11 +0000 (19:25 +0200)
Previously we just printed an error message about not specifying a command
to get help about, and no hint about how to work out which commands even
existed.

Signed-off-by: Zane Bitter <zbitter@redhat.com>
bin/heat

index e574ff1d7da9c9393dc35bc5e4a0774b8c43dd30..b67d824e452c512e2c0609a98efc3f523ab0e466 100755 (executable)
--- a/bin/heat
+++ b/bin/heat
@@ -434,14 +434,14 @@ def print_help(options, args):
     """
     Print help specific to a command
     """
-    if len(args) != 1:
-        sys.exit("Please specify a command")
-
     parser = options.__parser
-    command_name = args.pop()
-    command = lookup_command(parser, command_name)
 
-    print command.__doc__ % {'prog': os.path.basename(sys.argv[0])}
+    if not args:
+        parser.print_usage()
+
+    subst = {'prog': os.path.basename(sys.argv[0])}
+    docs = [lookup_command(parser, cmd).__doc__ % subst for cmd in args]
+    print '\n\n'.join(docs)
 
 
 def lookup_command(parser, command_name):