INNER CODE UNIT · Go
checkCommand
eksctl-io/eksctl · cmd/eksctl/main.go:116
func checkCommand(rootCmd *cobra.Command) {
for _, cmd := range rootCmd.Commands() {
// just a precaution as the verb command didn't have runE
if cmd.RunE != nil {
continue
}
// mcp command does not need a resource type
if cmd.Name() == "mcp" {
continue
}
cmd.RunE = func(c *cobra.Command, args []string) error {
var e error
if len(args) == 0 {
e = fmt.Errorf("please provide a valid resource for \"%s\"", c.Name())
} else {
e = fmt.Errorf("unknown resource type \"%s\"", args[0])
}
fmt.Printf("Error: %s\n\n", e.Error())