[GRASS-user] Python GUI
Glynn Clements
glynn at gclements.plus.com
Wed Oct 1 15:27:24 EDT 2008
Hamish wrote:
> > > The opt->options part of the parser only allows
> > through full names.
>
> Moritz Lennert wrote:
> > But it should be possible to parse the answer taking into account
> > shorter versions. See, for example, how type_opt is parsed on lines
> > 478ff in display/d.vect/main.c.
>
>
> sure there's code in d.vect to handle it, but the parser won't actually
> let you give anything but the full words listed in the ->options line.
r33643 allows "enumerated" options (those with a list of valid
choices) to be abbreviated.
The answer must either be an exact match, or a prefix of exactly one
choice. E.g. for "g.list type=...", "rast" and "rast3d" are valid
(exact matches), "rast3" is valid (prefix of "rast3d" only), but "ras"
is rejected as ambiguous (prefix of both "rast" and "rast3d").
If an abbreviated answer is chosen, opt->answer (or for multiple
answers, opt->answers[i]) is replaced with a (deep) copy of the
unabbreviated name.
Note that where opt->multiple == YES, opt->answer *isn't*
reconstructed with the unabbreviated value, so this won't currently
work with g.parser (i.e. with scripts), or with anything that uses
opt->answer instead of opt->answers[].
Needless to say, this shouldn't be backported until it has been
thoroughly tested.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list