[GRASS-dev] significant change in g.parser behavior for GRASS 7

Glynn Clements glynn at gclements.plus.com
Fri Sep 26 19:29:44 PDT 2014


Michael Barton wrote:

> At the very least, the error generated needs to be something along
> the lines of “upper case characters are not allowed for option names
> in GRASS modules”

Right.

The current behaviour is a side-effect of the argument simply not
being considered as an option if the LHS of the = doesn't comply with
the requirements for option names.

Currently, the parser code doesn't perform any validation on the
options defined by the program. It attempts to detect run-time errors
arising from the user supplying invalid arguments; it doesn't attempt
to detect programming errors such as using an invalid name for an
option.

This wouldn't be particularly hard to do. Before processing argv[],
G_parser() already iterates over the defined options to synchronise
the string and list-of-strings forms of the options, descriptions and
answers fields.

I'll add a check for invalid option names to that code.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list