PR#645: don't fail on CLI plugins without docstrings

Merges #645
https://pagure.io/koji/pull-request/645

Fixes: #644
https://pagure.io/koji/issue/644
CLI fails on plugins without docstrings
This commit is contained in:
Mike McLean 2017-10-30 21:36:22 -04:00
commit c3a0b4673e
2 changed files with 2 additions and 1 deletions

View file

@ -275,7 +275,7 @@ def list_commands(categories_chosen=None):
for category in categories_chosen:
print(_("\n%s:" % categories[category]))
for alias,handler in handlers:
desc = handler.__doc__
desc = handler.__doc__ or ''
if desc.startswith('[%s] ' % category):
desc = desc[len('[%s] ' % category):]
elif category != 'misc' or desc.startswith('['):

View file

@ -206,6 +206,7 @@ Most simple command would look like this:
@export_cli
def anon_handle_echo(options, session, args):
"[info] Print arguments"
usage = _("usage: %prog echo <message>")
parser = OptionParser(usage=usage)
(opts, args) = parser.parse_args(args)