/
root.go
52 lines (46 loc) · 821 Bytes
/
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
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "gool",
Short: "Gool make your life easier",
SilenceErrors: true,
SilenceUsage: true,
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
func init() {
cobra.EnableCommandSorting = false
rootCmd.AddCommand(shellCmd)
rootCmd.AddCommand(commands()...)
rootCmd.AddCommand(versionCmd)
}
func commands() []*cobra.Command {
return []*cobra.Command{
timestampToDateCmd,
dateToTimestampCmd,
jwtDecodeCmd,
md5Cmd,
urlEncodeCmd,
urlDecodeCmd,
urlToJSON,
base64EncodeCmd,
base64DecodeCmd,
randStringCmd,
countCmd,
CamelCaseCmd,
KebabCaseCmd,
LowerCaseCmd,
SnakeCaseCmd,
StartCaseCmd,
UpperCaseCmd,
formatJSONCmd,
}
}