forked from pivotal-cf/pivnet-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.go
38 lines (29 loc) · 765 Bytes
/
product.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package commands
import "github.com/pivotal-cf/pivnet-cli/commands/product"
type ProductCommand struct {
ProductSlug string `long:"product-slug" short:"p" description:"Product slug e.g. p-mysql" required:"true"`
}
type ProductsCommand struct {
}
//go:generate counterfeiter . ProductClient
type ProductClient interface {
List() error
Get(productSlug string) error
}
var NewProductClient = func() ProductClient {
return product.NewProductClient(
NewPivnetClient(),
ErrorHandler,
Pivnet.Format,
OutputWriter,
Printer,
)
}
func (command *ProductsCommand) Execute([]string) error {
Init()
return NewProductClient().List()
}
func (command *ProductCommand) Execute([]string) error {
Init()
return NewProductClient().Get(command.ProductSlug)
}