mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
ExactValidArgs slated for removal
This commit is contained in:
parent
488a4bc560
commit
08304cc038
1 changed files with 6 additions and 1 deletions
7
args.go
7
args.go
|
@ -90,7 +90,12 @@ func ExactArgs(n int) PositionalArgs {
|
|||
// there are not exactly N positional args OR
|
||||
// there are any positional args that are not in the `ValidArgs` field of `Command`
|
||||
func ExactValidArgs(n int) PositionalArgs {
|
||||
return ComposedArgs(ExactArgs(n), OnlyValidArgs)
|
||||
return func(cmd *Command, args []string) error {
|
||||
if err := ExactArgs(n)(cmd, args); err != nil {
|
||||
return err
|
||||
}
|
||||
return OnlyValidArgs(cmd, args)
|
||||
}
|
||||
}
|
||||
|
||||
// RangeArgs returns an error if the number of args is not within the expected range.
|
||||
|
|
Loading…
Add table
Reference in a new issue