2020-02-19 16:48:55 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
2020-10-07 04:11:36 +00:00
|
|
|
"go.jolheiser.com/gpm/config"
|
|
|
|
|
2020-02-19 16:48:55 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
2020-02-20 19:09:56 +00:00
|
|
|
"go.jolheiser.com/beaver"
|
2020-02-19 16:48:55 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var List = cli.Command{
|
|
|
|
Name: "list",
|
|
|
|
Aliases: []string{"l"},
|
|
|
|
Usage: "List local packages",
|
|
|
|
Action: doList,
|
|
|
|
}
|
|
|
|
|
2020-10-07 04:11:36 +00:00
|
|
|
func doList(_ *cli.Context) error {
|
|
|
|
cfg, err := config.Load()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, pkg := range cfg.Packages {
|
2020-02-19 16:48:55 +00:00
|
|
|
beaver.Infof("%s -> %s", pkg.Name, pkg.Import)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|