From ea94a3db55f84f026891709d82ebf25e17f89e0d Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral <38422348+umarcor@users.noreply.github.com> Date: Tue, 21 Jun 2022 03:00:50 +0100 Subject: [PATCH] undefined or nil Args default to ArbitraryArgs (#1612) --- command.go | 2 +- user_guide.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/command.go b/command.go index 0f4511f38..3349be636 100644 --- a/command.go +++ b/command.go @@ -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) } diff --git a/user_guide.md b/user_guide.md index 3a253de99..5a7acf88e 100644 --- a/user_guide.md +++ b/user_guide.md @@ -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: