class Github::Issues
Public Instance Methods
list()
click to toggle source
# File lib/github/issues.rb, line 15 def list issues = Github::CLI.repository.issues(page: options[:page]) page_count = issues.count_pages == 0 ? 1 : issues.count_pages say "Issues for #{Github::CLI.repository.id} (Page #{options[:page]}/#{page_count})" title_width = width_for_percent(0.45) creator_width = width_for_percent(0.15) format_s = "%-8s %-#{title_width}.#{title_width}s %-#{creator_width}s %s" say sprintf(format_s, '#', 'Title', 'User', 'Date') issues.each do |issue| say sprintf(format_s, "##{issue.number}", issue.title, issue.user.login, time_ago_in_words(Date.parse(issue.updated_at)) + ' ago') end end
show(number)
click to toggle source
# File lib/github/issues.rb, line 32 def show(number) issue = Github::CLI.repository.issue(number) say "##{number} - #{issue.title}" say sprintf("%#{terminal_width}s", "#{issue.user.login} on #{issue.created_at}") say hr say issue.body + "\n" return if issue.comments == 0 comments = Github::CLI.repository.issue_comments(number) comments.each do |comment| say hr say sprintf("%#{terminal_width}s", "#{comment.user.login} on #{comment.created_at}") say comment.body end end