Revision b6a99832 kamaki/cli/command_shell.py

b/kamaki/cli/command_shell.py
35 35
from os import popen
36 36
from sys import stdout
37 37

  
38
from kamaki.cli import _exec_cmd, _print_error_message
38
from kamaki.cli import exec_cmd, print_error_message, print_subcommands_help
39 39
from kamaki.cli.argument import ArgumentParseManager
40
from kamaki.cli.utils import print_dict, split_input, print_items
40
from kamaki.cli.utils import print_dict, split_input
41 41
from kamaki.cli.history import History
42 42
from kamaki.cli.errors import CLIError
43 43
from kamaki.clients import ClientError
......
189 189
                    arg.value = getattr(cmd_parser.parsed, name, arg.default)
190 190

  
191 191
                try:
192
                    _exec_cmd(instance,
192
                    exec_cmd(instance,
193 193
                        cmd_parser.unparsed,
194 194
                        cmd_parser.parser.print_help)
195 195
                except (ClientError, CLIError) as err:
196
                    _print_error_message(err)
196
                    print_error_message(err)
197 197
            elif ('-h' in cmd_args or '--help' in cmd_args) \
198 198
            or len(cmd_args):  # print options
199
                print('%s: %s' % (cmd.name, subcmd.help))
200
                options = {}
201
                for sub in subcmd.get_subcommands():
202
                    options[sub.name] = sub.help
203
                print_dict(options)
199
                print_subcommands_help(cmd)
204 200
            else:  # change context
205 201
                #new_context = this
206 202
                backup_context = self._backup()
......
233 229
                        break
234 230
                print('Syntax: %s %s' % (' '.join(clist[upto:]), cls.syntax))
235 231
            else:
236
                options = dict(name='Options:')
237
                for sub in cmd.get_subcommands():
238
                    options[sub.name] = sub.help
239
                print_items([options])
232
                print_subcommands_help(cmd)
240 233

  
241 234
        self._register_method(help_method, 'help_%s' % cmd.name)
242 235

  

Also available in: Unified diff