提交 948b19f6 编写于 作者: P Pascal Corpet

Display only issues created by <CREATOR>.

上级 a6611a17
...@@ -33,6 +33,9 @@ With no arguments, show a list of open issues. ...@@ -33,6 +33,9 @@ With no arguments, show a list of open issues.
-a, --assignee <ASSIGNEE> -a, --assignee <ASSIGNEE>
Display only issues assigned to <ASSIGNEE>. Display only issues assigned to <ASSIGNEE>.
-c, --creator <CREATOR>
Display only issues created by <CREATOR>.
When opening an issue, this can be a comma-separated list of people to When opening an issue, this can be a comma-separated list of people to
assign to the new issue. assign to the new issue.
...@@ -121,6 +124,7 @@ With no arguments, show a list of open issues. ...@@ -121,6 +124,7 @@ With no arguments, show a list of open issues.
flagIssueFormat, flagIssueFormat,
flagIssueMessage, flagIssueMessage,
flagIssueMilestoneFilter, flagIssueMilestoneFilter,
flagIssueCreator,
flagIssueFile string flagIssueFile string
flagIssueBrowse bool flagIssueBrowse bool
...@@ -143,6 +147,7 @@ func init() { ...@@ -143,6 +147,7 @@ func init() {
cmdIssue.Flag.StringVarP(&flagIssueState, "state", "s", "", "STATE") cmdIssue.Flag.StringVarP(&flagIssueState, "state", "s", "", "STATE")
cmdIssue.Flag.StringVarP(&flagIssueFormat, "format", "f", "%sC%>(8)%i%Creset %t% l%n", "FORMAT") cmdIssue.Flag.StringVarP(&flagIssueFormat, "format", "f", "%sC%>(8)%i%Creset %t% l%n", "FORMAT")
cmdIssue.Flag.StringVarP(&flagIssueMilestoneFilter, "milestone", "M", "", "MILESTONE") cmdIssue.Flag.StringVarP(&flagIssueMilestoneFilter, "milestone", "M", "", "MILESTONE")
cmdIssue.Flag.StringVarP(&flagIssueCreator, "creator", "c", "", "CREATOR")
cmdIssue.Use(cmdCreateIssue) cmdIssue.Use(cmdCreateIssue)
CmdRunner.Use(cmdIssue) CmdRunner.Use(cmdIssue)
...@@ -170,6 +175,9 @@ func listIssues(cmd *Command, args *Args) { ...@@ -170,6 +175,9 @@ func listIssues(cmd *Command, args *Args) {
if cmd.FlagPassed("milestone") { if cmd.FlagPassed("milestone") {
filters["milestone"] = flagIssueMilestoneFilter filters["milestone"] = flagIssueMilestoneFilter
} }
if cmd.FlagPassed("creator") {
filters["creator"] = flagIssueCreator
}
issues, err := gh.FetchIssues(project, filters) issues, err := gh.FetchIssues(project, filters)
utils.Check(err) utils.Check(err)
......
...@@ -31,7 +31,7 @@ Feature: hub issue ...@@ -31,7 +31,7 @@ Feature: hub issue
""" """
And the exit status should be 0 And the exit status should be 0
Scenario: Fetch issues for a given milestone Scenario: Fetch issues not assigned to any milestone
Given the GitHub API server: Given the GitHub API server:
""" """
get('/repos/github/hub/issues') { get('/repos/github/hub/issues') {
...@@ -43,19 +43,35 @@ Feature: hub issue ...@@ -43,19 +43,35 @@ Feature: hub issue
:state => "open", :state => "open",
:user => { :login => "octocat" }, :user => { :login => "octocat" },
}, },
{ :number => 13, ]
:title => "Second issue", }
"""
When I run `hub issue -M none`
Then the output should contain exactly:
"""
#102 First issue\n
"""
And the exit status should be 0
Scenario: Fetch issues created by a given user
Given the GitHub API server:
"""
get('/repos/github/hub/issues') {
assert :creator => "octocat"
json [
{ :number => 102,
:title => "First issue",
:state => "open", :state => "open",
:user => { :login => "octocat" }, :user => { :login => "octocat" },
}, },
] ]
} }
""" """
When I run `hub issue -M none` When I run `hub issue -c octocat`
Then the output should contain exactly: Then the output should contain exactly:
""" """
#102 First issue #102 First issue\n
#13 Second issue\n
""" """
And the exit status should be 0 And the exit status should be 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册