Commit 8a2c3b5c authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

commands/cli: Made Parse return an error if request has unrecognized options

parent dea82709
......@@ -37,6 +37,14 @@ func Parse(input []string, root *cmds.Command) (cmds.Request, *cmds.Command, []s
return nil, cmd, path, err
}
// check to make sure there aren't any undefined options
for k := range opts {
if _, found := optDefs[k]; !found {
err = fmt.Errorf("Unrecognized option: -%s", k)
return nil, cmd, path, err
}
}
req := cmds.NewRequest(path, opts, args, cmd, optDefs)
err = cmd.CheckArguments(req)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment