update flags
This commit is contained in:
parent
5607fee576
commit
f3b47d9f57
15
cmd/add.go
15
cmd/add.go
|
@ -8,15 +8,9 @@ import (
|
|||
"kubeye/pkg/validator"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(addCmd)
|
||||
flag.Parse()
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
}
|
||||
|
||||
var addCmd = &cobra.Command{
|
||||
Use: "install ntp",
|
||||
Short: "install the ntp",
|
||||
Use: "install npd",
|
||||
Short: "install the npd",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := validator.Add(cmd.Context())
|
||||
if err != nil {
|
||||
|
@ -24,3 +18,8 @@ var addCmd = &cobra.Command{
|
|||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(addCmd)
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
}
|
||||
|
|
15
cmd/audit.go
15
cmd/audit.go
|
@ -1,20 +1,15 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"kubeye/pkg/validator"
|
||||
)
|
||||
|
||||
var config string
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(auditCmd)
|
||||
//flag.Parse()
|
||||
//pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
auditCmd.Flags().StringVarP(&config, "filename", "f", "", "Customize best practice configuration")
|
||||
}
|
||||
|
||||
var auditCmd = &cobra.Command{
|
||||
Use: "audit",
|
||||
Short: "audit the result",
|
||||
|
@ -25,3 +20,9 @@ var auditCmd = &cobra.Command{
|
|||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(auditCmd)
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
auditCmd.Flags().StringVarP(&config, "filename", "f", "", "Customize best practice configuration")
|
||||
}
|
||||
|
|
|
@ -21,9 +21,11 @@ import (
|
|||
"os"
|
||||
)
|
||||
|
||||
var Verbose bool
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "ke",
|
||||
Short: "kubeye the cluster configuration",
|
||||
Short: "Kubeye the cluster configuration",
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
|
@ -32,3 +34,6 @@ func Execute() {
|
|||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().BoolVar(&Verbose, "debug", true, "Print detailed information")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue