* Use -a or --assignee to filter repo issues list by assignee
* Makes it easier to find pull requests and issues you've been
  assigned to address
This commit is contained in:
Dennis Cornwell 2016-01-31 20:46:12 -05:00
Родитель 2042549f0a
Коммит ffaa3ecb37
3 изменённых файлов: 48 добавлений и 2 удалений

Просмотреть файл

@ -33,6 +33,7 @@ var (
`,
}
flagIssueAssignee,
flagIssueMessage,
flagIssueFile string
@ -44,6 +45,8 @@ func init() {
cmdCreateIssue.Flag.StringVarP(&flagIssueFile, "file", "f", "", "FILE")
cmdCreateIssue.Flag.VarP(&flagIssueLabels, "label", "l", "LABEL")
cmdIssue.Flag.StringVarP(&flagIssueAssignee, "assignee", "a", "", "ASSIGNEE")
cmdIssue.Use(cmdCreateIssue)
CmdRunner.Use(cmdIssue)
}
@ -66,8 +69,11 @@ func issue(cmd *Command, args *Args) {
} else {
url = issue.HTMLURL
}
// "nobody" should have more than 1 million github issues
ui.Printf("% 7d] %s ( %s )\n", issue.Number, issue.Title, url)
if flagIssueAssignee == "" || issue.Assignee.Login == flagIssueAssignee {
// "nobody" should have more than 1 million github issues
ui.Printf("% 7d] %s ( %s )\n", issue.Number, issue.Title, url)
}
}
}
})

31
features/issue.feature Normal file
Просмотреть файл

@ -0,0 +1,31 @@
Feature: hub issue
Background:
Given I am in "git://github.com/github/hub.git" git repo
And I am "cornwe19" on github.com with OAuth token "OTOKEN"
Scenario: Fetch issues
Given the remote issues of "github/hub" are:
"""
[
{ :number => 102,
:title => "First issue",
:html_url => "https://github.com/github/hub/issues/102",
:assignee => {
:login => "octokit"
}
},
{ :number => 103,
:title => "Second issue",
:html_url => "https://github.com/github/hub/issues/103",
:assignee => {
:login => "cornwe19"
}
}
]
"""
When I run `hub issue -a cornwe19`
Then the output should contain exactly:
"""
103] Second issue ( https://github.com/github/hub/issues/103 )\n
"""
And the exit status should be 0

Просмотреть файл

@ -82,6 +82,15 @@ Given(/^there is a commit named "([^"]+)"$/) do |name|
run_silent %(git reset --quiet --hard HEAD^)
end
Given(/^the remote issues of "(.*?)" are:$/) do |proj, json_value|
status_endpoint = <<-EOS
get('/repos/#{proj}/issues') {
json(#{json_value})
}
EOS
step %{the GitHub API server:}, status_endpoint
end
When(/^I make (a|\d+) commits?(?: with message "([^"]+)")?$/) do |num, msg|
num = num == 'a' ? 1 : num.to_i
num.times { empty_commit(msg) }