diff options
author | Michael Muré <batolettre@gmail.com> | 2021-03-29 10:58:10 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-03-29 11:02:08 +0200 |
commit | aa0449a3eafa42c8c0d44bbdc2b79c5f47bd2d32 (patch) | |
tree | cd0c72a0229bb38cf8096ce198384cdd972f66e2 /commands/ls.go | |
parent | 5215634d0dca37c545904fbc8a12ddd9b8eb72df (diff) | |
parent | e985653701e8438e27ee5f925fd0aa7c0eef09fe (diff) | |
download | git-bug-aa0449a3eafa42c8c0d44bbdc2b79c5f47bd2d32.tar.gz |
Merge remote-tracking branch 'origin/master' into dag-entity
Diffstat (limited to 'commands/ls.go')
-rw-r--r-- | commands/ls.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/commands/ls.go b/commands/ls.go index 327fd37f..71c420c6 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -19,6 +19,7 @@ import ( type lsOptions struct { statusQuery []string authorQuery []string + metadataQuery []string participantQuery []string actorQuery []string labelQuery []string @@ -65,6 +66,8 @@ git bug ls status:open --by creation "foo bar" baz "Filter by status. Valid values are [open,closed]") flags.StringSliceVarP(&options.authorQuery, "author", "a", nil, "Filter by author") + flags.StringSliceVarP(&options.metadataQuery, "metadata", "m", nil, + "Filter by metadata. Example: github-url=URL") flags.StringSliceVarP(&options.participantQuery, "participant", "p", nil, "Filter by participant") flags.StringSliceVarP(&options.actorQuery, "actor", "A", nil, @@ -337,6 +340,16 @@ func completeQuery(q *query.Query, opts lsOptions) error { } q.Author = append(q.Author, opts.authorQuery...) + for _, str := range opts.metadataQuery { + tokens := strings.Split(str, "=") + if len(tokens) < 2 { + return fmt.Errorf("no \"=\" in key=value metadata markup") + } + var pair query.StringPair + pair.Key = tokens[0] + pair.Value = tokens[1] + q.Metadata = append(q.Metadata, pair) + } q.Participant = append(q.Participant, opts.participantQuery...) q.Actor = append(q.Actor, opts.actorQuery...) q.Label = append(q.Label, opts.labelQuery...) |