summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/cobra/args.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-06-17 08:13:40 +0000
committerLibravatar GitHub <noreply@github.com>2024-06-17 08:13:40 +0000
commit7ab404d64335dc0b6977e9fb38140ad6fc5b91b7 (patch)
tree5c589e9a69f90ad6bc50036f5632758f1e5bf3ac /vendor/github.com/spf13/cobra/args.go
parent[chore]: Bump golang.org/x/oauth2 from 0.20.0 to 0.21.0 (#3015) (diff)
downloadgotosocial-7ab404d64335dc0b6977e9fb38140ad6fc5b91b7.tar.xz
[chore]: Bump github.com/spf13/cobra from 1.8.0 to 1.8.1 (#3016)
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) {