Display only issues updated at or after a certain time.

This commit is contained in:
Pascal Corpet 2016-08-18 09:25:35 +02:00
Родитель 5ddce90357
Коммит f03978c3e8
2 изменённых файлов: 30 добавлений и 1 удалений

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

@ -17,7 +17,7 @@ var (
cmdIssue = &Command{
Run: listIssues,
Usage: `
issue [-a <ASSIGNEE>] [-c <CREATOR>] [-@ <USER] [-s <STATE>] [-f <FORMAT>] [-M <MILESTONE>] [-l <LABELS>]
issue [-a <ASSIGNEE>] [-c <CREATOR>] [-@ <USER] [-s <STATE>] [-f <FORMAT>] [-M <MILESTONE>] [-l <LABELS>] [-t <TIME>]
issue create [-o] [-m <MESSAGE>|-F <FILE>] [-a <USERS>] [-M <MILESTONE>] [-l <LABELS>]
`,
Long: `Manage GitHub issues for the current project.
@ -115,6 +115,10 @@ With no arguments, show a list of open issues.
Display only issues with certain labels.
When opening an issue, add a comma-separated list of labels to this issue.
-t, --since <TIME>
Display only issues updated at or after a certain time. The time is a
timestamp in ISO-8601 format: YYYY-MM-DDTHH:MM:SSZ.
`,
}
@ -133,6 +137,7 @@ With no arguments, show a list of open issues.
flagIssueCreator,
flagIssueMentioned,
flagIssueLabelsFilter,
flagIssueSince,
flagIssueFile string
flagIssueBrowse bool
@ -158,6 +163,7 @@ func init() {
cmdIssue.Flag.StringVarP(&flagIssueCreator, "creator", "c", "", "CREATOR")
cmdIssue.Flag.StringVarP(&flagIssueMentioned, "mentioned", "@", "", "USER")
cmdIssue.Flag.StringVarP(&flagIssueLabelsFilter, "label", "l", "", "LABELS")
cmdIssue.Flag.StringVarP(&flagIssueSince, "since", "t", "", "TIME")
cmdIssue.Use(cmdCreateIssue)
CmdRunner.Use(cmdIssue)
@ -181,6 +187,7 @@ func listIssues(cmd *Command, args *Args) {
"milestone": flagIssueMilestoneFilter,
"creator": flagIssueCreator,
"mentioned": flagIssueMentioned,
"since": flagIssueSince,
}
filters := map[string]interface{}{}
for flag, filter := range flagFilters {

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

@ -119,6 +119,28 @@ Feature: hub issue
"""
And the exit status should be 0
Scenario: Fetch issues updated after a certain time
Given the GitHub API server:
"""
get('/repos/github/hub/issues') {
assert :since => "2016-08-18T09:11:32Z"
json [
{ :number => 102,
:title => "First issue",
:state => "open",
:user => { :login => "octocat" },
},
]
}
"""
When I run `hub issue -t 2016-08-18T09:11:32Z`
Then the output should contain exactly:
"""
#102 First issue\n
"""
And the exit status should be 0
Scenario: Fetch issues across multiple pages
Given the GitHub API server:
"""