/
bundle.go
44 lines (37 loc) · 861 Bytes
/
bundle.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
39
40
41
42
43
44
package commands
import (
"github.com/jlentink/aem/internal/output"
"github.com/spf13/cobra"
)
type commandBundle struct {
verbose bool
cmd *cobra.Command
}
func (c *commandBundle) setup() *cobra.Command {
c.cmd = &cobra.Command{
Use: "bundle",
Aliases: []string{},
Short: "Bundle commands",
PreRun: c.preRun,
Run: c.run,
}
commands = []Command{
&commandBundleList{},
&commandBundleInstall{},
&commandBundleStart{},
&commandBundelStop{},
}
for _, cmd := range commands {
c.cmd.AddCommand(cmd.setup())
}
return c.cmd
}
func (c *commandBundle) preRun(cmd *cobra.Command, args []string) {
c.verbose, _ = cmd.Flags().GetBool("verbose")
output.SetVerbose(verbose)
ConfigCheckListProjects()
RegisterProject()
}
func (c *commandBundle) run(cmd *cobra.Command, args []string) {
cmd.Help() // nolint: errcheck
}