[GRASS-dev] G_parser() changes in 7.0

Glynn Clements glynn at gclements.plus.com
Thu Jun 11 12:28:08 EDT 2009


In 7.0, I have changed the way that the parser compares command-line
arguments against the list of defined options.

Rather than checking that the supplied option is a prefix of a defined
option, it splits the option name into words, treating underscores as
word delimiters, then checks that the supplied option is composed of
prefixes of individual words.

This allows e.g. "lev_red=" to be abbreviated to e.g. "lr=".

This reduces the amount of typing required for long options, and
should reduce the need to use abbreviations when defining options,
e.g. lev_red could be replaced with levels_red without increasing the
amount of typing required.

One drawback is that there may be cases where it's now necessary to
type more of the option name to ensure a unique match.

Please report any bugs.

I would also appreciate comments on how (or whether) to support
abbreviating an option which is a prefix of another option. E.g. 
g.remove has rast= and rast3d= options; changing rast= to raster= and
rast3d= to raster_3d= would mean that you couldn't use rast= as it
would be an abbreviation of both raster= and raster_3d=.

At present, any option which is a prefix of another option has to be
typed in full to bypass the ambiguity check (an exact match is never
considered ambiguous), which encourages using abbreviations in the
option definitions.

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


More information about the grass-dev mailing list