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

commands/cli,http: Make sure required file arguments are provided

This commit is contained in:
Matt Bell
2014-11-16 23:56:21 -08:00
parent bc8a97c119
commit 9333c504c1
2 changed files with 16 additions and 0 deletions

View File

@ -248,6 +248,13 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
argDefIndex++
}
// 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)
}
}
return stringArgs, fileArgs, nil
}