Skip to content

Instantly share code, notes, and snippets.

@phrohdoh

phrohdoh/ghi.rb Secret

Last active August 29, 2015 14:18
Show Gist options
  • Save phrohdoh/1d02b5241218cf4b5b70 to your computer and use it in GitHub Desktop.
Save phrohdoh/1d02b5241218cf4b5b70 to your computer and use it in GitHub Desktop.
issues.map { |i|
n, title, labels = i['number'], i['title'], i['labels']
l = 9 + nmax + rmax + no_color { format_labels labels }.to_s.length
a = i['assignee'] && i['assignee']['login'] == Authorization.username
l += 2 if a
p = i['pull_request']['html_url'] and l += 2
c = i['comments']
l += c.to_s.length + 1 unless c == 0
[
" ",
(i['repo'].to_s.rjust(rmax) if i['repo']),
format_number(n.to_s.rjust(nmax)),
truncate(title, l),
format_labels(labels),
(fg('aaaaaa') { c } unless c == 0),
(fg('aaaaaa') { '↑' } if p),
(fg(:yellow) { '@' } if a)
].compact.join ' '
}
issues.map { |i|
issue_num, title, labels = i['number'], i['title'], i['labels']
line_length = 9 + nmax + rmax + no_color { format_labels labels }.to_s.length
has_assignee = i['assignee'] && i['assignee']['login'] == Authorization.username
line_length += 2 if has_assignee
is_pull_request = i['pull_request']['html_url'] and line_length += 2
comment_count = i['comments']
line_length += comment_count.to_s.length + 1 unless comment_count == 0
[
" ",
(i['repo'].to_s.rjust(rmax) if i['repo']),
format_number(issue_num.to_s.rjust(nmax)),
truncate(title, line_length),
format_labels(labels),
#(fg('aaaaaa') { comment_count } unless c == 0),
(fg('aaaaaa') { comment_count }),
#(fg('aaaaaa') { '↑' } if is_pull_request),
(fg(:red) { 'pr' } if is_pull_request),
(fg(:yellow) { '@' } if has_assignee)
].compact.join ' '
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment