|
7 | 7 | "os"
|
8 | 8 | "os/exec"
|
9 | 9 | "path/filepath"
|
| 10 | + "regexp" |
10 | 11 | "strings"
|
11 | 12 | "time"
|
12 | 13 |
|
@@ -56,6 +57,7 @@ Example use:
|
56 | 57 | includeTransDependants, _ = cmd.Flags().GetBool("transitive-dependants")
|
57 | 58 | components, _ = cmd.Flags().GetBool("components")
|
58 | 59 | filterType, _ = cmd.Flags().GetStringArray("filter-type")
|
| 60 | + filterName, _ = cmd.Flags().GetString("filter-name") |
59 | 61 | watch, _ = cmd.Flags().GetBool("watch")
|
60 | 62 | parallel, _ = cmd.Flags().GetBool("parallel")
|
61 | 63 | rawOutput, _ = cmd.Flags().GetBool("raw-output")
|
@@ -131,6 +133,21 @@ Example use:
|
131 | 133 | }
|
132 | 134 | }
|
133 | 135 |
|
| 136 | + if filterName != "" { |
| 137 | + filterExpr, err := regexp.Compile(filterName) |
| 138 | + if err != nil { |
| 139 | + log.WithError(err).Fatal("invalid filter-name expression") |
| 140 | + } |
| 141 | + for pkg := range pkgs { |
| 142 | + if filterExpr.MatchString(pkg.FullName()) { |
| 143 | + continue |
| 144 | + } |
| 145 | + |
| 146 | + log.WithField("package", pkg.FullName()).Debug("filtering out due to filter-name") |
| 147 | + delete(pkgs, pkg) |
| 148 | + } |
| 149 | + } |
| 150 | + |
134 | 151 | spkgs := make([]*leeway.Package, 0, len(pkgs))
|
135 | 152 | for p := range pkgs {
|
136 | 153 | spkgs = append(spkgs, p)
|
@@ -305,6 +322,7 @@ func init() {
|
305 | 322 | execCmd.Flags().Bool("transitive-dependants", false, "select transitive package dependants")
|
306 | 323 | execCmd.Flags().Bool("components", false, "select the package's components (e.g. instead of selecting three packages from the same component, execute just once in the component origin)")
|
307 | 324 | execCmd.Flags().StringArray("filter-type", nil, "only select packages of this type")
|
| 325 | + execCmd.Flags().String("filter-name", "", "only select packages matching this name regular expression") |
308 | 326 | execCmd.Flags().Bool("watch", false, "Watch source files and re-execute on change")
|
309 | 327 | execCmd.Flags().Bool("parallel", false, "Start all executions in parallel independent of their order")
|
310 | 328 | execCmd.Flags().Bool("raw-output", false, "Produce output without package prefix")
|
|
0 commit comments