(cmd *cobra.Command, args []string)
| 54 | } |
| 55 | |
| 56 | func NoArgsQuoteReminder(cmd *cobra.Command, args []string) error { |
| 57 | if len(args) < 1 { |
| 58 | return nil |
| 59 | } |
| 60 | |
| 61 | errMsg := fmt.Sprintf("unknown argument %q", args[0]) |
| 62 | if len(args) > 1 { |
| 63 | errMsg = fmt.Sprintf("unknown arguments %q", args) |
| 64 | } |
| 65 | |
| 66 | hasValueFlag := false |
| 67 | cmd.Flags().Visit(func(f *pflag.Flag) { |
| 68 | if f.Value.Type() != "bool" { |
| 69 | hasValueFlag = true |
| 70 | } |
| 71 | }) |
| 72 | |
| 73 | if hasValueFlag { |
| 74 | errMsg += "; please quote all values that have spaces" |
| 75 | } |
| 76 | |
| 77 | return FlagErrorf("%s", errMsg) |
| 78 | } |
| 79 | |
| 80 | // Partition takes a slice of any type T and separates it into two slices |
| 81 | // of the same type based on the provided predicate function. Any item |
nothing calls this directly
no test coverage detected