io.py 文件源码

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

项目:jira_pub_sync 作者: d-lobanov 项目源码 文件源码
def edit_unsync_issues(cls, issues):
        """
        Allows a user to manage all new tasks. They can have three statuses: migrate, skip and hide.
        """

        MARKER = """
# Commands:
# m = migrate issue.
# s = skip issue for this time (also you can just remove the line).
# h = hide issue (skip and never migrate).
        """

        max_len = max([len(issue.fields.summary) for issue in issues])
        max_len = max_len if max_len < 200 else 200

        def line_format(issue):
            summary = cls.truncate_summary(issue.fields.summary, max_len).ljust(max_len + 2)

            return 'm  ' + issue.key + '\t' + summary + '  ' + issue.permalink()

        items = [line_format(issue) for issue in issues]

        while True:
            message = click.edit("\n".join(items) + '\n\n' + MARKER)
            if message is None:
                raise Abort

            lines = message.split(MARKER, 1)[0].rstrip('\n').split('\n')
            if lines == ['']:
                raise Abort

            try:
                return cls._read_unsync_issues(lines, issues)
            except InputException as e:
                cls.error(e.message, nl=True)
                click.pause()

                continue
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号