From 14ce66f0dde4345e6b08f528aa435196d132e2b8 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Fri, 5 Apr 2019 16:42:45 +0200 Subject: integrate actors and participant filters into ls and show commands --- commands/ls.go | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'commands/ls.go') diff --git a/commands/ls.go b/commands/ls.go index 75819f1a..ca74cc46 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -11,13 +11,15 @@ import ( ) var ( - lsStatusQuery []string - lsAuthorQuery []string - lsTitleQuery []string - lsLabelQuery []string - lsNoQuery []string - lsSortBy string - lsSortDirection string + lsStatusQuery []string + lsAuthorQuery []string + lsParticipantQuery []string + lsLabelQuery []string + lsTitleQuery []string + lsActorQuery []string + lsNoQuery []string + lsSortBy string + lsSortDirection string ) func runLsBug(cmd *cobra.Command, args []string) error { @@ -89,6 +91,16 @@ func lsQueryFromFlags() (*cache.Query, error) { query.Author = append(query.Author, f) } + for _, actor := range lsActorQuery { + f := cache.ActorFilter(actor) + query.Actor = append(query.Actor, f) + } + + for _, participant := range lsParticipantQuery { + f := cache.ParticipantFilter(participant) + query.Participant = append(query.Participant, f) + } + for _, label := range lsLabelQuery { f := cache.LabelFilter(label) query.Label = append(query.Label, f) @@ -151,6 +163,10 @@ func init() { "Filter by status. Valid values are [open,closed]") lsCmd.Flags().StringSliceVarP(&lsAuthorQuery, "author", "a", nil, "Filter by author") + lsCmd.Flags().StringSliceVarP(&lsParticipantQuery, "participant", "p", nil, + "Filter by participant") + lsCmd.Flags().StringSliceVarP(&lsActorQuery, "actor", "A", nil, + "Filter by actor") lsCmd.Flags().StringSliceVarP(&lsLabelQuery, "label", "l", nil, "Filter by label") lsCmd.Flags().StringSliceVarP(&lsTitleQuery, "title", "t", nil, -- cgit