At present, if a command takes no arguments, it's required to check by hand that it hasn't been passed an argument. That's error-prone and unnecessary, since CommandObject has a way for sub-classes to register what arguments they take, and that could be checked directly after the command line parse. I only do this for CommandObjectParsed. There isn't enough information to do a generic check for CommandObjectRaw, since these are explicitly unstructured commands.
This patch has four parts:
- The tiny bit of code in CommandObjectParsed::Execute that does the check
- Fixing up the handful of commands that hadn't registered their arguments (up to now this was not required)
These were pretty straightforward. I did have to fix up a bunch of the RenderScript commands. I don't know
who's responsible for the Renderscript plugin these days, so I picked one of the more recent contributors to
that file at random...
- Removing all the ad hoc checks for arguments passed to commands that don't take them
- Fixing up the tests that relied on the exact wording of the ad hoc errors
We can do a lot more with the argument info - automating completions and validation of arguments for commands that do take them. But here I'm only dealing with the automatic error generation for commands that take no arguments.