Restore 2nd level command sysntax in shell
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Wed, 15 May 2013 13:12:27 +0000 (16:12 +0300)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Wed, 15 May 2013 13:12:27 +0000 (16:12 +0300)
Refs: #3736

Changelog
kamaki/cli/command_shell.py

index e66a8e4..954c450 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ Bug Fixes:
 
 - Stop shell from destroying the config instance
 - Shell can manage all valid command line arguments [#3716]
+- Restore 2nd level command syntax in shell [#3736]
 
 Changes:
 
index 7be59a7..789b090 100644 (file)
@@ -160,7 +160,7 @@ class Shell(Cmd):
         self.__dict__ = oldcontext
 
     @staticmethod
-    def _create_help_method(cmd_name, args, descr):
+    def _create_help_method(cmd_name, args, descr, syntax):
         tmp_args = dict(args)
         tmp_args.pop('options', None)
         tmp_args.pop('debug', None)
@@ -170,6 +170,7 @@ class Shell(Cmd):
         tmp_args.pop('config', None)
         help_parser = ArgumentParseManager(cmd_name, tmp_args)
         help_parser.parser.description = descr
+        help_parser.syntax = syntax
         return help_parser.parser.print_help
 
     def _register_command(self, cmd_path):
@@ -205,7 +206,8 @@ class Shell(Cmd):
                     cmd_parser.syntax = '%s %s' % (
                         subcmd.path.replace('_', ' '), cls.syntax)
                     help_method = self._create_help_method(
-                        cmd.name, cmd_parser.arguments, subcmd.help)
+                        cmd.name, cmd_parser.arguments,
+                        subcmd.help, cmd_parser.syntax)
                     if '-h' in cmd_args or '--help' in cmd_args:
                         help_method()
                         if ldescr.strip():