(cmd *cobra.Command, args []string)
| 36 | } |
| 37 | |
| 38 | func NoArgsQuoteReminder(cmd *cobra.Command, args []string) error { |
| 39 | if len(args) < 1 { |
| 40 | return nil |
| 41 | } |
| 42 | |
| 43 | errMsg := fmt.Sprintf("unknown argument %q", args[0]) |
| 44 | if len(args) > 1 { |
| 45 | errMsg = fmt.Sprintf("unknown arguments %q", args) |
| 46 | } |
| 47 | |
| 48 | hasValueFlag := false |
| 49 | cmd.Flags().Visit(func(f *pflag.Flag) { |
| 50 | if f.Value.Type() != "bool" { |
| 51 | hasValueFlag = true |
| 52 | } |
| 53 | }) |
| 54 | |
| 55 | if hasValueFlag { |
| 56 | errMsg += "; please quote all values that have spaces" |
| 57 | } |
| 58 | |
| 59 | return FlagErrorf("%s", errMsg) |
| 60 | } |
| 61 | |
| 62 | // Partition takes a slice of any type T and separates it into two slices |
| 63 | // of the same type based on the provided predicate function. Any item |
nothing calls this directly
no test coverage detected