Show long description if available
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Tue, 18 Dec 2012 16:12:28 +0000 (18:12 +0200)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Tue, 18 Dec 2012 16:12:28 +0000 (18:12 +0200)
kamaki/cli/__init__.py
kamaki/cli/command_shell.py

index 841010a..cb81b66 100644 (file)
@@ -291,16 +291,18 @@ def update_parser_help(parser, cmd):
     parser.syntax = parser.syntax.split('<')[0]
     parser.syntax += ' '.join(_best_match)
 
+    description = ''
     if cmd.is_command:
         cls = cmd.get_class()
         parser.syntax += ' ' + cls.syntax
         parser.update_arguments(cls().arguments)
-        # arguments = cls().arguments
-        # update_arguments(parser, arguments)
+        description = getattr(cls, 'long_description', '')
+        description = description.strip()
     else:
         parser.syntax += ' <...>'
     if cmd.has_description:
-        parser.parser.description = cmd.help
+        parser.parser.description = cmd.help\
+        + ((' . . . %s' % description) if description else '')
 
 
 def print_error_message(cli_err):
index 8c880f6..83d70ca 100644 (file)
@@ -196,6 +196,7 @@ class Shell(Cmd):
                     print_error_message(err)
             elif ('-h' in cmd_args or '--help' in cmd_args) \
             or len(cmd_args):  # print options
+                print('%s' % cmd.help)
                 print_subcommands_help(cmd)
             else:  # change context
                 #new_context = this