def _expand_group(self, group, prefix):
"""
Recursively expands a Group into paginator
:param group: the Group to expand
:param prefix: prefix of the line
"""
if not isinstance(group, Group):
entry = '**{prefix}{0}** - {1}'.format(group.name, group.short_doc, prefix=prefix)
shortened = self.shorten(entry)
self._paginator.add_line(shortened)
else:
entry = '**{prefix}{0}** - {1}'.format(group.name, group.short_doc, prefix=prefix)
shortened = self.shorten(entry)
self._paginator.add_line(shortened)
for subcommand in group.commands.copy().values():
# Build the prefix with group name so we get a nice list
self._expand_group(subcommand, ' {prefix}{0} '.format(group.name, prefix=prefix))
评论列表
文章目录