-
Notifications
You must be signed in to change notification settings - Fork 4
/
root.go
59 lines (46 loc) · 1.05 KB
/
root.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
50
51
52
53
54
55
56
57
58
59
package template
import (
"fmt"
"bunnyshell.com/cli/cmd/template/repository"
"bunnyshell.com/cli/pkg/build"
"bunnyshell.com/cli/pkg/config"
"bunnyshell.com/cli/pkg/config/option"
"bunnyshell.com/cli/pkg/util"
"github.com/spf13/cobra"
)
var mainCmd = &cobra.Command{
Use: "templates",
Aliases: []string{"tpl"},
Short: "Template",
Long: "Bunnyshell Template",
}
var mainGroup = &cobra.Group{
ID: "templates",
Title: "Commands for Templates:",
}
func init() {
config.MainManager.CommandWithAPI(mainCmd)
mainCmd.AddGroup(mainGroup)
util.AddGroupedCommands(
mainCmd,
cobra.Group{
ID: "subresources",
Title: "Commands for Template subresources:",
},
[]*cobra.Command{
repository.GetMainCommand(),
},
)
}
func GetMainCommand() *cobra.Command {
return mainCmd
}
func getIDOption(value *string) *option.String {
help := fmt.Sprintf(
`Find available Templates with "%s templates list"`,
build.Name,
)
option := option.NewStringOption(value)
option.AddFlagWithExtraHelp("id", "Template ID", help)
return option
}