-
Notifications
You must be signed in to change notification settings - Fork 1
/
flags.go
49 lines (42 loc) · 1.06 KB
/
flags.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
45
46
47
48
49
package flags
import (
"github.com/spf13/cobra"
"ldcli/internal/analytics"
"ldcli/internal/flags"
)
func NewFlagsCmd(analyticsTracker analytics.Tracker, client flags.Client) (*cobra.Command, error) {
cmd := &cobra.Command{
Use: "flags",
Short: "Make requests (list, create, etc.) on flags",
Long: "Make requests (list, create, etc.) on flags",
PersistentPreRun: func(c *cobra.Command, args []string) {
analytics.SendCommandRunEvent("flags", c, analyticsTracker)
},
}
createCmd, err := NewCreateCmd(client)
if err != nil {
return nil, err
}
getCmd, err := NewGetCmd(client)
if err != nil {
return nil, err
}
updateCmd, err := NewUpdateCmd(client)
if err != nil {
return nil, err
}
toggleOnUpdateCmd, err := NewToggleOnUpdateCmd(client)
if err != nil {
return nil, err
}
toggleOffUpdateCmd, err := NewToggleOffUpdateCmd(client)
if err != nil {
return nil, err
}
cmd.AddCommand(createCmd)
cmd.AddCommand(getCmd)
cmd.AddCommand(updateCmd)
cmd.AddCommand(toggleOnUpdateCmd)
cmd.AddCommand(toggleOffUpdateCmd)
return cmd, nil
}