NoArgs is a validator for commands to print an error when an argument is provided
()
| 22 | |
| 23 | // NoArgs is a validator for commands to print an error when an argument is provided |
| 24 | func NoArgs() cobra.PositionalArgs { |
| 25 | return func(cmd *cobra.Command, args []string) error { |
| 26 | extractArgs := ExactArgsWithMsg(0, fmt.Sprintf( |
| 27 | "`%s` does not take any positional arguments.", |
| 28 | cmd.CommandPath(), |
| 29 | )) |
| 30 | |
| 31 | return extractArgs(cmd, args) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | // ExactArgs is the same as ExactArgsWithMsg but displays |
| 36 | // a default error message |
no test coverage detected