1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 11:31:54 +08:00

commands/cli: Fixed Parse required argument check

This commit is contained in:
Matt Bell
2014-11-17 01:38:51 -08:00
parent ce49541f13
commit d4ac442838

View File

@ -249,9 +249,11 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
}
// check to make sure we didn't miss any required arguments
for _, argDef := range argDefs[argDefIndex:] {
if argDef.Required {
return nil, nil, fmt.Errorf("Argument '%s' is required", argDef.Name)
if len(argDefs) > argDefIndex {
for _, argDef := range argDefs[argDefIndex:] {
if argDef.Required {
return nil, nil, fmt.Errorf("Argument '%s' is required", argDef.Name)
}
}
}