mirror of
https://github.com/spf13/cobra
synced 2025-05-06 13:27:26 +00:00
parent
5e9ccc4d64
commit
d1e8e8b3c0
1 changed files with 1 additions and 1 deletions
|
@ -389,7 +389,7 @@ The following validators are built in:
|
||||||
- `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args.
|
- `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args.
|
||||||
- `MaximumNArgs(int)` - the command will report an error if there are more than N positional args.
|
- `MaximumNArgs(int)` - the command will report an error if there are more than N positional args.
|
||||||
- `ExactArgs(int)` - the command will report an error if there are not exactly N positional args.
|
- `ExactArgs(int)` - the command will report an error if there are not exactly N positional args.
|
||||||
- `ExactValidArgs(int)` = the command will report and error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command`
|
- `ExactValidArgs(int)` - the command will report an error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command`
|
||||||
- `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args.
|
- `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args.
|
||||||
|
|
||||||
An example of setting the custom validator:
|
An example of setting the custom validator:
|
||||||
|
|
Loading…
Add table
Reference in a new issue