mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
undefined or nil Args default to ArbitraryArgs (#1612)
This commit is contained in:
parent
7c9831d376
commit
ea94a3db55
2 changed files with 3 additions and 3 deletions
|
@ -1012,7 +1012,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
|||
|
||||
func (c *Command) ValidateArgs(args []string) error {
|
||||
if c.Args == nil {
|
||||
return nil
|
||||
return ArbitraryArgs(c, args)
|
||||
}
|
||||
return c.Args(c, args)
|
||||
}
|
||||
|
|
|
@ -326,8 +326,8 @@ In both of these cases:
|
|||
|
||||
## Positional and Custom Arguments
|
||||
|
||||
Validation of positional arguments can be specified using the `Args` field
|
||||
of `Command`.
|
||||
Validation of positional arguments can be specified using the `Args` field of `Command`.
|
||||
If `Args` is undefined or `nil`, it defaults to `ArbitraryArgs`.
|
||||
|
||||
The following validators are built in:
|
||||
|
||||
|
|
Loading…
Reference in a new issue