code: func CheckFlags(cmd *cobra.Command) []error {
  	allFlagsSlice := []*pflag.Flag{}
  
  	cmd.Flags().VisitAll(func(f *pflag.Flag) {
  		allFlagsSlice = append(allFlagsSlice, f)
  	})
  	cmd.PersistentFlags().VisitAll(func(f *pflag.Flag) {
  		allFlagsSlice = append(allFlagsSlice, f)
  	})
  
  	fmt.Fprintf(os.Stdout, "   ↳ checking %d flags\n", len(allFlagsSlice))
  
  	errors := []error{}
  
  	// check flags long names
  	regex, err := regexp.Compile(`^[a-z]+[a-z\-]*$`)
  	if err != nil {
  		errors = append(errors, fmt.Errorf("command %q: unable to compile regex to check flags", cmd.CommandPath()))
  		return errors
  	}
  	for _, flag := range allFlagsSlice {
  		name := flag.Name
  		if !regex.MatchString(name) {
  			errors = append(errors, fmt.Errorf("command %q: flag name %q is invalid, long form of flag names can only contain lowercase characters or dash (must match %v)", cmd.CommandPath(), name, regex))
  		}
  	}
  
  	return errors
  }
docs: // CheckFlags checks if the command-line flags are valid