[#98] add --status option for JQL filter on status with list command

This commit is contained in:
Cory Bennett
2017-09-13 00:12:20 -07:00
parent 052e038d73
commit 5da04c1f86
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -52,6 +52,7 @@ func CmdListUsage(cmd *kingpin.CmdClause, opts *ListOptions) error {
cmd.Flag("query", "Jira Query Language (JQL) expression for the search").Short('q').StringVar(&opts.Query)
cmd.Flag("queryfields", "Fields that are used in \"list\" template").Short('f').StringVar(&opts.QueryFields)
cmd.Flag("reporter", "Reporter to search for").Short('r').StringVar(&opts.Reporter)
cmd.Flag("status", "Filter on issue status").Short('S').StringVar(&opts.Status)
cmd.Flag("sort", "Sort order to return").Short('s').StringVar(&opts.Sort)
cmd.Flag("watcher", "Watcher to search for").Short('w').StringVar(&opts.Watcher)
return nil
+4
View File
@@ -22,6 +22,7 @@ type SearchOptions struct {
IssueType string
Watcher string
Reporter string
Status string
Sort string
MaxResults int
}
@@ -49,6 +50,9 @@ func (o *SearchOptions) ProvideSearchRequest() *jiradata.SearchRequest {
if o.Reporter != "" {
qbuff.WriteString(fmt.Sprintf(" AND reporter = '%s'", o.Reporter))
}
if o.Status != "" {
qbuff.WriteString(fmt.Sprintf(" AND status = '%s'", o.Status))
}
if o.Sort != "" {
qbuff.WriteString(fmt.Sprintf(" ORDER BY %s", o.Sort))
}