From 801d02c1b9e8d3587b711072b28310195e3f9408 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Apr 18 2019 05:46:58 +0000 Subject: Allow specifying multiple package paths at a time. --- diff --git a/cmd/golist/golist.go b/cmd/golist/golist.go index 30a6651..03238d0 100644 --- a/cmd/golist/golist.go +++ b/cmd/golist/golist.go @@ -8,8 +8,9 @@ import ( "sort" "strings" - "pagure.io/golist/pkg/util" "github.com/urfave/cli" + + "pagure.io/golist/pkg/util" ) // TODO(jchaloup): @@ -34,7 +35,7 @@ func main() { Name: "ignore-regex, r", Usage: "Regex specified files/dirs to ignore", }, - cli.StringFlag{ + cli.StringSliceFlag{ Name: "package-path", Usage: "Package entry point", }, @@ -78,7 +79,7 @@ func main() { app.Action = func(c *cli.Context) error { - if c.String("package-path") == "" { + if len(c.StringSlice("package-path")) == 0 { return fmt.Errorf("--package-path is not set") } @@ -109,9 +110,10 @@ func main() { } collector := util.NewPackageInfoCollector(ignore, c.StringSlice("include-extension")) - if err := collector.CollectPackageInfos(c.String("package-path")); err != nil { - return err - + for _, packagePath := range c.StringSlice("package-path") { + if err := collector.CollectPackageInfos(packagePath); err != nil { + return err + } } if c.Bool("json") {