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"
|
"kubeye/pkg/validator"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
rootCmd.AddCommand(addCmd)
|
|
||||||
flag.Parse()
|
|
||||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
|
||||||
}
|
|
||||||
|
|
||||||
var addCmd = &cobra.Command{
|
var addCmd = &cobra.Command{
|
||||||
Use: "install ntp",
|
Use: "install npd",
|
||||||
Short: "install the ntp",
|
Short: "install the npd",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
err := validator.Add(cmd.Context())
|
err := validator.Add(cmd.Context())
|
||||||
if err != nil {
|
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
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/pflag"
|
||||||
"kubeye/pkg/validator"
|
"kubeye/pkg/validator"
|
||||||
)
|
)
|
||||||
|
|
||||||
var config string
|
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{
|
var auditCmd = &cobra.Command{
|
||||||
Use: "audit",
|
Use: "audit",
|
||||||
Short: "audit the result",
|
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"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Verbose bool
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "ke",
|
Use: "ke",
|
||||||
Short: "kubeye the cluster configuration",
|
Short: "Kubeye the cluster configuration",
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
|
@ -32,3 +34,6 @@ func Execute() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func init() {
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&Verbose, "debug", true, "Print detailed information")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue