Class: GithubIssuesCli::Command::Show

Inherits:
GithubIssuesCli::Command show all
Defined in:
lib/github_issues_cli/command/show.rb

Instance Attribute Summary

Attributes inherited from GithubIssuesCli::Command

#git_repo, #username

Instance Method Summary collapse

Methods inherited from GithubIssuesCli::Command

#authenticate, #get_git_push_target, #get_git_repo, #get_issue_number, #get_pullrequest, #get_source_branch, #get_upstream_repo, #initialize, #run

Constructor Details

This class inherits a constructor from GithubIssuesCli::Command

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/github_issues_cli/command/show.rb', line 4

def execute
  github_repo = get_upstream_repo
  issue_number = get_issue_number
  issues_client = Github::Issues.new
  issue = issues_client.get :user => github_repo[:user], :repo => github_repo[:name], :number => issue_number
  comments = issues_client.comments.all :issue_id => issue_number

  puts
  print bold issue_number + ': ' + issue[:title] + ' '
  if issue[:state] == 'open'
    print white on_green [:state]
  else
    print white on_red issue[:state]
  end
  puts
  if issue[:body]
    puts issue[:body]
    puts
  end
  puts

  comments.each do |c|
    print yellow '@' + c.user.
    puts ':'
    puts c[:body]
    puts
  end
end