Class: GithubIssuesCli::Command::List

Inherits:
GithubIssuesCli::Command show all
Defined in:
lib/github_issues_cli/command/list.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



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

def execute
  github_repo = get_upstream_repo
  repo_name = github_repo[:user] + '/' + github_repo[:name]
  query = [
    "repo:#{repo_name}",
  ]
  query.push("state:open") unless show_closed?
  if custom_query.nil?
    query.push("assignee:#{@username}") if mine?
  else
    query.push(custom_query)
  end
  result = Github::Client::Search.new.issues :q => query.join(' ')

  result.items.each do |issue|
    if not issue.assignee.nil? and issue.assignee. == @username
      print yellow '●'
    else
      print ' '
    end
    print bold(issue.number.to_s.rjust(5) + ':')
    print ' ' + issue.title
    puts
  end
end