summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/cobra/args.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/spf13/cobra/args.go')
-rw-r--r--vendor/github.com/spf13/cobra/args.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go
index e79ec33a8..ed1e70cea 100644
--- a/vendor/github.com/spf13/cobra/args.go
+++ b/vendor/github.com/spf13/cobra/args.go
@@ -52,9 +52,9 @@ func OnlyValidArgs(cmd *Command, args []string) error {
if len(cmd.ValidArgs) > 0 {
// Remove any description that may be included in ValidArgs.
// A description is following a tab character.
- var validArgs []string
+ validArgs := make([]string, 0, len(cmd.ValidArgs))
for _, v := range cmd.ValidArgs {
- validArgs = append(validArgs, strings.Split(v, "\t")[0])
+ validArgs = append(validArgs, strings.SplitN(v, "\t", 2)[0])
}
for _, v := range args {
if !stringInSlice(v, validArgs) {