mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-19 18:05:32 +08:00
commands: Don't error on file arg checking (for now)
This commit is contained in:
@ -195,6 +195,9 @@ func (c *Command) GetOptions(path []string) (map[string]Option, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Command) CheckArguments(req Request) error {
|
func (c *Command) CheckArguments(req Request) error {
|
||||||
|
|
||||||
|
// TODO: check file arguments
|
||||||
|
|
||||||
args := req.Arguments()
|
args := req.Arguments()
|
||||||
argDefs := c.Arguments
|
argDefs := c.Arguments
|
||||||
|
|
||||||
@ -217,7 +220,7 @@ func (c *Command) CheckArguments(req Request) error {
|
|||||||
valueIndex := 0 // the index of the current value (in `args`)
|
valueIndex := 0 // the index of the current value (in `args`)
|
||||||
for _, argDef := range c.Arguments {
|
for _, argDef := range c.Arguments {
|
||||||
// skip optional argument definitions if there aren't sufficient remaining values
|
// skip optional argument definitions if there aren't sufficient remaining values
|
||||||
if len(args)-valueIndex <= numRequired && !argDef.Required {
|
if len(args)-valueIndex <= numRequired && !argDef.Required || argDef.Type == ArgFile {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user