kubeeye/cmd/audit.go

28 lines
538 B
Go
Raw Normal View History

package cmd
import (
"fmt"
"github.com/spf13/cobra"
"kubeye/pkg/validator"
)
2020-11-25 20:45:05 +08:00
var config string
func init() {
rootCmd.AddCommand(auditCmd)
2020-11-25 20:45:05 +08:00
//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",
Run: func(cmd *cobra.Command, args []string) {
2020-11-25 20:45:05 +08:00
err := validator.Cluster(config, cmd.Context())
if err != nil {
fmt.Println(err)
}
},
}