Ejemplo n.º 1
0
 def format_comment(self, comment):
     fs = '@{uline}{u.login}{default} -- {date}\n{body}\n'
     body = wrap(comment.body_text)
     date = comment.created_at.strftime('%Y-%m-%d %H:%M:%S')
     return fs.format(u=comment.user,
                      uline=tc['underline'],
                      default=tc['default'],
                      date=date,
                      body=body)
Ejemplo n.º 2
0
    def print_pull(self, number):
        pull = self.get_pull(number)
        if not pull:
            return self.FAILURE

        header = self.format_short_pull(pull)
        body = wrap(pull.body_text)
        print('{0}\n{1}\n{2}\n'.format(header, sep, body))
        print('{0}Files modified:{1}'.format(tc['underline'], tc['default']))
        self.print_files(pull)
        return self.SUCCESS
Ejemplo n.º 3
0
    def print_pull(self, number):
        pull = self.get_pull(number)
        if not pull:
            return self.FAILURE

        header = self.format_short_pull(pull)
        body = wrap(pull.body_text)
        print('{0}\n{1}\n{2}\n'.format(header, sep, body))
        print('{0}Files modified:{1}'.format(tc['underline'], tc['default']))
        self.print_files(pull)
        return self.SUCCESS
Ejemplo n.º 4
0
    def print_comments(self, number):
        pull = self.get_pull(number)
        if not pull:
            return self.FAILURE

        for c in pull.iter_comments():
            fs = '@{uline}{u.login}{default} -- {date}\n{body}\n'
            body = '\n'.join(wrap(c.body_text))
            date = c.created_at.strftime('%Y-%m-%d %H:%M:%S')
            print(fs.format(u=c.user, date=date, body=body,
                            uline=tc['underline'], default=tc['default']))

        return self.SUCCESS
Ejemplo n.º 5
0
    def print_comments(self, number):
        pull = self.get_pull(number)
        if not pull:
            return self.FAILURE

        for c in pull.iter_comments():
            fs = '@{uline}{u.login}{default} -- {date}\n{body}\n'
            body = '\n'.join(wrap(c.body_text))
            date = c.created_at.strftime('%Y-%m-%d %H:%M:%S')
            print(
                fs.format(u=c.user,
                          date=date,
                          body=body,
                          uline=tc['underline'],
                          default=tc['default']))

        return self.SUCCESS
Ejemplo n.º 6
0
    def run(self, options, args):
        self.get_repo(options)
        opts, args = self.parser.parse_args(args)

        if opts.help:
            self.help()

        number = get_issue_number(args, self.parser,
                                  'An issue number is required.')

        if number is None:
            return self.FAILURE

        issue = self.repo.issue(number)

        format_str = '{header}\n{sep}\n{body}\n'
        title = ('#{0.number}: {1[bold]}{0.title}{1[default]} - '
                 '@{0.user}'.format(issue, tc))
        body = wrap(issue.body_text or '')
        print(format_str.format(header=title, sep=sep, body=body))
        return self.SUCCESS
Ejemplo n.º 7
0
    def run(self, options, args):
        self.get_repo(options)
        opts, args = self.parser.parse_args(args)

        if opts.help:
            self.help()

        number = get_issue_number(
            args, self.parser, 'An issue number is required.'
        )

        if number is None:
            return self.FAILURE

        issue = self.repo.issue(number)

        format_str = '{header}\n{sep}\n{body}\n'
        title = ('#{0.number}: {1[bold]}{0.title}{1[default]} - '
                 '@{0.user}'.format(issue, tc))
        body = wrap(issue.body_text or '')
        print(format_str.format(header=title, sep=sep, body=body))
        return self.SUCCESS
Ejemplo n.º 8
0
 def format_comment(self, comment):
     fs = '@{uline}{u.login}{default} -- {date}\n{body}\n'
     body = wrap(comment.body_text)
     date = comment.created_at.strftime('%Y-%m-%d %H:%M:%S')
     return fs.format(u=comment.user, uline=tc['underline'],
                      default=tc['default'], date=date, body=body)
Ejemplo n.º 9
0
 def test_wrap(self):
     assert ''.join(wrap('foo')) == 'foo'