Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
feat: include filter match on group name (#144)
Browse files Browse the repository at this point in the history
I'm often working on a group of vectors so it's useful for me to run just that group instead of just a single vector. This PR updates the include filter to also match against the vector group name, so you can include a whole group, or just a single vector.
  • Loading branch information
Alan Shaw authored Sep 15, 2020
1 parent df4841e commit e4a5da0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gen/builders/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func NewGenerator() *Generator {
flag.BoolVar(&force, "force", false, forceUsage)

var includeFilter string
const includeFilterUsage = "regex inclusion filter to select a subset of vectors to execute; matched against the vector's ID."
const includeFilterUsage = "regex inclusion filter to select a subset of vectors to execute; matched against the vector's ID or the vector group name."
flag.StringVar(&includeFilter, "i", "", includeFilterUsage)
flag.StringVar(&includeFilter, "include", "", includeFilterUsage)

Expand Down Expand Up @@ -223,7 +223,7 @@ func (g *Generator) Group(group string, vectors ...*VectorDef) {

var wg sync.WaitGroup
for _, item := range vectors {
if id := item.Metadata.ID; g.IncludeFilter != nil && !g.IncludeFilter.MatchString(id) {
if id := item.Metadata.ID; g.IncludeFilter != nil && !g.IncludeFilter.MatchString(id) && !g.IncludeFilter.MatchString(group) {
log.Printf("skipping %s: does not match inclusion filter", id)
continue
}
Expand Down

0 comments on commit e4a5da0

Please sign in to comment.