Skip to content

Commit

Permalink
ExactValidArgs slated for removal
Browse files Browse the repository at this point in the history
  • Loading branch information
nelz9999 committed Sep 6, 2019
1 parent f384040 commit 5789947
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion args.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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.
Expand Down

0 comments on commit 5789947

Please sign in to comment.