-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.go
40 lines (32 loc) · 929 Bytes
/
main.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
package main
import (
"zenit/agent"
"zenit/aws"
"zenit/mysql"
"zenit/service"
"zenit/version"
"github.com/debeando/go-common/log"
"github.com/spf13/cobra"
)
var verbose bool
func main() {
var rootCmd = &cobra.Command{
Use: "zenit [COMMANDS] [OPTIONS]",
Long: `zenit is a multipurpose tool for a MySQL, you can; monitoring, lint
data model and more, please see available commands.
Find more information at: https://github.com/debeando/zenit`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Enable verbose/debug mode.
if verbose {
log.SetLevel(log.DebugLevel)
}
},
}
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
rootCmd.AddCommand(agent.NewCommand())
rootCmd.AddCommand(aws.NewCommand())
rootCmd.AddCommand(mysql.NewCommand())
rootCmd.AddCommand(service.NewCommand())
rootCmd.AddCommand(version.NewCommand())
rootCmd.Execute()
}