Revision 0238c167 kamaki/cli/__init__.py
b/kamaki/cli/__init__.py | ||
---|---|---|
42 | 42 |
from sys import exit, stdout, argv |
43 | 43 |
|
44 | 44 |
from kamaki.cli.errors import CLIError, CLICmdSpecError |
45 |
from kamaki.cli.utils import magenta, red, yellow, print_dict, remove_colors |
|
45 |
from kamaki.cli.utils import magenta, red, yellow, print_dict, print_list,\ |
|
46 |
remove_colors |
|
46 | 47 |
from kamaki.cli.command_tree import CommandTree |
47 | 48 |
from kamaki.cli.argument import _arguments, parse_known_args |
48 | 49 |
from kamaki.cli.history import History |
... | ... | |
145 | 146 |
|
146 | 147 |
|
147 | 148 |
def _print_error_message(cli_err): |
148 |
errmsg = '%s (%s)' % (cli_err, cli_err.status if cli_err.status else ' ')
|
|
149 |
errmsg = '%s' % cli_err
|
|
149 | 150 |
if cli_err.importance == 1: |
150 | 151 |
errmsg = magenta(errmsg) |
151 | 152 |
elif cli_err.importance == 2: |
... | ... | |
153 | 154 |
elif cli_err.importance > 2: |
154 | 155 |
errmsg = red(errmsg) |
155 | 156 |
stdout.write(errmsg) |
156 |
if cli_err.details is not None and len(cli_err.details) > 0: |
|
157 |
print(': %s' % cli_err.details) |
|
158 |
else: |
|
159 |
print() |
|
157 |
print_list(cli_err.details) |
|
160 | 158 |
|
161 | 159 |
|
162 | 160 |
def get_command_group(unparsed): |
Also available in: Unified diff