-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.go
27 lines (23 loc) · 1001 Bytes
/
cmd.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
package tpl
import "github.com/jageros/goctl/internal/cobrax"
var (
varStringHome string
varStringCategory string
varStringName string
// Cmd describes a template command.
Cmd = cobrax.NewCommand("template")
initCmd = cobrax.NewCommand("init", cobrax.WithRunE(genTemplates))
cleanCmd = cobrax.NewCommand("clean", cobrax.WithRunE(cleanTemplates))
updateCmd = cobrax.NewCommand("update", cobrax.WithRunE(updateTemplates))
revertCmd = cobrax.NewCommand("revert", cobrax.WithRunE(revertTemplates))
)
func init() {
initCmd.Flags().StringVar(&varStringHome, "home")
cleanCmd.Flags().StringVar(&varStringHome, "home")
updateCmd.Flags().StringVar(&varStringHome, "home")
updateCmd.Flags().StringVarP(&varStringCategory, "category", "c")
revertCmd.Flags().StringVar(&varStringHome, "home")
revertCmd.Flags().StringVarP(&varStringCategory, "category", "c")
revertCmd.Flags().StringVarP(&varStringName, "name", "n")
Cmd.AddCommand(cleanCmd, initCmd, revertCmd, updateCmd)
}