Can ctl init with index
This commit is contained in:
@@ -2,6 +2,7 @@ package root
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
@@ -15,6 +16,16 @@ import (
|
||||
versioncmd "undecided.project/monok8s/pkg/cmd/version"
|
||||
)
|
||||
|
||||
func init() {
|
||||
klog.InitFlags(nil)
|
||||
|
||||
if os.Getenv("DEBUG") != "" {
|
||||
_ = flag.Set("v", "4") // debug level
|
||||
} else {
|
||||
_ = flag.Set("v", "0")
|
||||
}
|
||||
}
|
||||
|
||||
func NewRootCmd() *cobra.Command {
|
||||
flags := genericclioptions.NewConfigFlags(true)
|
||||
|
||||
@@ -24,7 +35,6 @@ func NewRootCmd() *cobra.Command {
|
||||
SilenceUsage: true,
|
||||
SilenceErrors: true,
|
||||
PersistentPreRun: func(*cobra.Command, []string) {
|
||||
klog.InitFlags(nil)
|
||||
_ = flag.Set("logtostderr", "true")
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user