summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Lucarella <leandro.lucarella@sociomantic.com>2014-04-25 18:33:28 +0200
committerMihails Strasuns <mihails.strasuns@sociomantic.com>2014-04-30 11:07:33 +0200
commita73246ca00069695a11e7b9641afb2fd4b3f09a8 (patch)
tree7a91888bd92b9226c20e683d38c9265f3efc3d0f
parenta451683a1655262cd9f5fe1766558e4589a9f1e1 (diff)
issue show: Improve issue formatting
-rwxr-xr-xgit-hub35
1 files changed, 17 insertions, 18 deletions
diff --git a/git-hub b/git-hub
index 6a35cf4..47eed1c 100755
--- a/git-hub
+++ b/git-hub
@@ -811,28 +811,27 @@ class IssueUtil (object):
@classmethod
def print_issue(cls, issue, comments):
issue = dict(issue)
- issue['labels'] = ', '.join([l['name']
+ issue['name'] = cls.name.capitalize()
+ issue['comments'] += issue.get('review_comments', 0)
+ issue['labels'] = ' '.join(['['+l['name']+']'
for l in issue.get('labels', [])])
- infof(
- (u"""
-Issue {number}
-=========
-
-Title : {title}
-User : {user[login]}
-State : {state}
-Comments: {comments}
-URL : {html_url}
-Labels : {labels}
-
-Contents
-========
+ if issue['labels']:
+ issue['labels'] += '\n'
+ infof(u"""
+#{number}: {title}
+================================================================================
+{name} is {state}, was reported by {user[login]} and has {comments} comment(s).
+{labels}<{html_url}>
+
{body}
-"""
- ), **issue)
+""",
+ **issue)
for comment in comments:
- infof(u'[{created_at}][{user[login]}]:\n{body}\n', **comment)
+ body = comment['body']
+ body = '\n'.join([' '+l for l in body.splitlines()])
+ infof(u'On {created_at}, {user[login]} commented:\n'
+ '{0}\n\n <{html_url}>\n', body, **comment)
@classmethod
def print_comment(cls, comment):