Ejemplo n.º 1
0
def format_issue(issue, verbose=True):
    output = []
    if verbose:
        indent = ""
    else:
        indent = " " * (5 - len(str(issue['number'])))
    title = "%s%s. %s" % (indent, issue['number'], issue['title'])
    if not verbose:
        output.append(title[:80])
    if verbose:
        title = wrap_text(title)
        output.append(title)
        if len(title) > 79:
            output.append("-" * 79)
        else:
            output.append("-" * len(title))
        if issue['body']:
            body = wrap_text(issue['body'])
            output.append(body)
        output.append("    state: %s" % issue['state'])
        output.append("     user: %s" % issue['user'])
        output.append("    votes: %s" % issue['votes'])
        output.append("  created: %s" % issue['created_at'])
        updated = issue.get('updated_at')
        if updated and not updated == issue['created_at']:
            output.append("  updated: %s" % updated)
        output.append(" ")
    return output
Ejemplo n.º 2
0
def format_issue(issue, verbose=True):
    output = []
    if verbose:
        indent = ""
    else:
        indent = " " * (5 - len(str(issue['number'])))
    title = "%s%s. %s" % (indent, issue['number'], issue['title'])
    title = smart_unicode(title)
    if not verbose:
        output.append(title[:80])
    if verbose:
        title = wrap_text(title)
        output.append(title)
        underline = get_underline(title)
        output.append(underline)
        if issue['body']:
            body = smart_unicode(wrap_text(issue['body']))
            output.append(body)
        output.append("    state: %s" % issue['state'])
        output.append("     user: %s" % issue['user'])
        output.append("    votes: %s" % issue['votes'])
        output.append("  created: %s" % issue['created_at'])
        updated = issue.get('updated_at')
        if updated and not updated == issue['created_at']:
            output.append("  updated: %s" % updated)
        output.append(" comments: %s" % issue.get('comments', 0))
        output.append(" ")
    return output
Ejemplo n.º 3
0
def format_comment(comment, nr, total):
    timestamp = comment.get("updated_at", comment["created_at"])
    title = "comment %s of %s by %s (%s)" % (nr, total, comment["user"],
        timestamp)
    output = [title]
    underline = get_underline(title)
    output.append(underline)
    body = wrap_text(comment['body'])
    output.append(body)
    return output
Ejemplo n.º 4
0
def format_comment(comment, nr, total):
    timestamp = comment.get("updated_at", comment["created_at"])
    title = "comment %s of %s by %s (%s)" % (nr, total, comment["user"],
        timestamp)
    title = smart_unicode(title)
    output = [title]
    underline = get_underline(title)
    output.append(underline)
    body = smart_unicode(wrap_text(comment['body']))
    output.append(body)
    return output