-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.go
49 lines (39 loc) 路 854 Bytes
/
init.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 cmd
import (
"os"
"github.com/hisamafahri/ting/cmd/convert"
"github.com/hisamafahri/ting/cmd/generate"
"github.com/hisamafahri/ting/cmd/root"
"github.com/spf13/cobra"
)
/*
Init the root command
*/
var rootCmd = &cobra.Command{
Use: "ting",
Short: "A CLI for tools developer use everyday",
Long: `Ting is a CLI tools to automate your everyday
task as a developer.`,
}
/*
Init the root function
*/
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
/*
Init all of the available commands
*/
func init() {
rootCmd.AddCommand(root.VersionCmd())
// Generate
rootCmd.AddCommand(generate.Generate)
generate.Generate.AddCommand(generate.GenerateUuid)
generate.Generate.AddCommand(generate.GenerateJwt)
// Convert
rootCmd.AddCommand(convert.Convert)
convert.Convert.AddCommand(convert.ConvertColor)
}