Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined or nil Args default to ArbitraryArgs #1612

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down