aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/cobra/args.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-05-22 20:53:53 +0200
committerMichael Muré <batolettre@gmail.com>2019-05-22 20:53:53 +0200
commit485ca5900486b7fc3ea71cbcbb39b87272ae09fd (patch)
tree92551be8e01130542f969d06282abfc4a1c43629 /vendor/github.com/spf13/cobra/args.go
parente781d6c7fe7dba2fc526c2049aa188c9988e1cf4 (diff)
downloadgit-bug-485ca5900486b7fc3ea71cbcbb39b87272ae09fd.tar.gz
vendor: update dependencies
Diffstat (limited to 'vendor/github.com/spf13/cobra/args.go')
-rw-r--r--vendor/github.com/spf13/cobra/args.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go
index a5d8a927..c4d820b8 100644
--- a/vendor/github.com/spf13/cobra/args.go
+++ b/vendor/github.com/spf13/cobra/args.go
@@ -78,6 +78,18 @@ func ExactArgs(n int) PositionalArgs {
}
}
+// ExactValidArgs returns an error if
+// 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 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.
func RangeArgs(min int, max int) PositionalArgs {
return func(cmd *Command, args []string) error {