Commit 546c4c57 authored by Steven Allen's avatar Steven Allen

remove redundant argument check from cli.Parse

This is also done in the Executor. Unfortunately, doing this *here* causes us to
block until we get an argument from stdin, even if we're handling a help call.
parent 34165236
......@@ -49,10 +49,6 @@ func Parse(ctx context.Context, input []string, stdin *os.File, root *cmds.Comma
return req, err
}
if err := req.Command.CheckArguments(req); err != nil {
return req, err
}
// if no encoding was specified by user, default to plaintext encoding
// (if command doesn't support plaintext, use JSON instead)
if enc := req.Options[cmds.EncLong]; enc == "" {
......
......@@ -480,6 +480,9 @@ func TestBodyArgs(t *testing.T) {
}
req, err := Parse(context.Background(), tc.cmd, tc.f, rootCmd)
if err == nil {
err = req.Command.CheckArguments(req)
}
if !errEq(err, tc.parseErr) {
t.Fatalf("parsing request for cmd %q: expected error %q, got %q", tc.cmd, tc.parseErr, err)
}
......
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