1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-28 08:47:42 +08:00

commands/http: s/lenRequired/numRequired/

This commit is contained in:
Matt Bell
2014-11-11 17:43:19 -08:00
committed by Juan Batiz-Benet
parent 50751617b6
commit f93b806d21

View File

@ -42,10 +42,10 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
args := make([]interface{}, 0)
// count required argument definitions
lenRequired := 0
numRequired := 0
for _, argDef := range cmd.Arguments {
if argDef.Required {
lenRequired++
numRequired++
}
}
@ -58,10 +58,10 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
for _, argDef := range cmd.Arguments {
// skip optional argument definitions if there aren't sufficient remaining values
if valCount <= lenRequired && !argDef.Required {
if valCount <= numRequired && !argDef.Required {
continue
} else if argDef.Required {
lenRequired--
numRequired--
}
if argDef.Type == cmds.ArgString {