@@ -24,6 +24,8 @@ import (
24
24
)
25
25
26
26
type CommonParams struct {
27
+ Debug bool
28
+
27
29
// es config
28
30
Host string
29
31
Port int
@@ -69,6 +71,7 @@ func init() {
69
71
// Here you will define your flags and configuration settings.
70
72
// Cobra supports persistent flags, which, if defined here,
71
73
// will be global for your application.
74
+ rootCmd .PersistentFlags ().BoolVar (& cParams .Debug , "debug" , false , "debug mode" )
72
75
rootCmd .PersistentFlags ().StringVar (& cParams .Host , "host" , "localhost" , "es host" )
73
76
rootCmd .PersistentFlags ().IntVar (& cParams .Port , "port" , 9200 , "es port" )
74
77
rootCmd .PersistentFlags ().StringVar (& cParams .IndexName , "index" , "" , "es index name" )
@@ -77,7 +80,7 @@ func init() {
77
80
78
81
// Cobra also supports local flags, which will only run
79
82
// when this action is called directly.
80
- rootCmd .Flags ().BoolP ("toggle" , "t" , false , "Help message for toggle" )
83
+ // rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
81
84
}
82
85
83
86
// initConfig reads in config file and ENV variables if set.
0 commit comments