formatter.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:aryas 作者: lattkkthxbbye 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号