#22 Allow specifying multiple package paths at a time.
Merged 4 years ago by qulogic. Opened 4 years ago by qulogic.
qulogic/golist multi-package  into  master

file modified
+8 -6
@@ -8,8 +8,9 @@ 

  	"sort"

  	"strings"

  

- 	"pagure.io/golist/pkg/util"

  	"github.com/urfave/cli"

+ 

+ 	"pagure.io/golist/pkg/util"

  )

  

  // TODO(jchaloup):
@@ -34,7 +35,7 @@ 

  			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 @@ 

  

  	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 @@ 

  		}

  

  		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") {

I didn't test this too much, but it seems to work.

Fixes #4.

rebased onto 801d02c

4 years ago

Pull-Request has been merged by qulogic

4 years ago
Metadata