Commit 030c0d3a authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Restore 2nd level command sysntax in shell

Refs: #3736
parent c2c1ebd4
......@@ -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:
......
......@@ -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():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment