Revision eb46e9a1 kamaki/cli/__init__.py
b/kamaki/cli/__init__.py | ||
---|---|---|
348 | 348 |
try: |
349 | 349 |
for cmd in cmds: |
350 | 350 |
if cmd.name in acceptable_groups: |
351 |
descriptions[cmd.name] = cmd.description
|
|
351 |
descriptions[cmd.name] = cmd.help
|
|
352 | 352 |
except TypeError: |
353 | 353 |
if _debug: |
354 | 354 |
kloger.warning( |
355 |
'No cmd description for module %s' % cmd_group) |
|
355 |
'No cmd description (help) for module %s' % cmd_group)
|
|
356 | 356 |
elif _debug: |
357 | 357 |
kloger.warning('Loading of %s cmd spec failed' % cmd_group) |
358 | 358 |
print('\nOptions:\n - - - -') |
... | ... | |
381 | 381 |
|
382 | 382 |
def print_subcommands_help(cmd): |
383 | 383 |
printout = {} |
384 |
for subcmd in cmd.get_subcommands():
|
|
384 |
for subcmd in cmd.subcommands.values():
|
|
385 | 385 |
spec, sep, print_path = subcmd.path.partition('_') |
386 |
printout[print_path.replace('_', ' ')] = subcmd.description
|
|
386 |
printout[print_path.replace('_', ' ')] = subcmd.help
|
|
387 | 387 |
if printout: |
388 | 388 |
print('\nOptions:\n - - - -') |
389 | 389 |
print_dict(printout) |
... | ... | |
396 | 396 |
|
397 | 397 |
description = '' |
398 | 398 |
if cmd.is_command: |
399 |
cls = cmd.get_class()
|
|
399 |
cls = cmd.cmd_class
|
|
400 | 400 |
parser.syntax += ' ' + cls.syntax |
401 | 401 |
parser.update_arguments(cls().arguments) |
402 |
description = getattr(cls, 'long_description', '') |
|
403 |
description = description.strip() |
|
402 |
description = getattr(cls, 'long_description', '').strip() |
|
404 | 403 |
else: |
405 | 404 |
parser.syntax += ' <...>' |
406 |
if cmd.has_description: |
|
407 |
parser.parser.description = cmd.help + ( |
|
408 |
('\n%s' % description) if description else '') |
|
409 |
else: |
|
410 |
parser.parser.description = description |
|
405 |
parser.parser.description = ( |
|
406 |
cmd.help + ('\n' if description else '')) if cmd.help else description |
|
411 | 407 |
|
412 | 408 |
|
413 | 409 |
def print_error_message(cli_err): |
Also available in: Unified diff