[GRASS5] g.parser with multiple=YES ?
glynn.clements at virgin.net
Fri Apr 16 12:34:47 EDT 2004
> > > I was just wondering how to use "option->multiple=YES;" in a bash
> > > script using g.parser? There seems to be something in the code, but
> > > no examples anywhere that I could find.
> > Although you can set the multiple flag, the answers field is ignored.
> > I presume that you can still split the $GIS_OPT_* value (taken from
> > the answer field) into its components manually.
> Looking into it, the string is passed regardless; using "multiple: yes"
> just changes the "--help" description to input=name[,name,..].
It will also affect the syntax checking (unless the type is "string",
in which case everything is valid), so there is some value in
supporting "multiple: yes".
> Each item
> within the enviro variable string still needs by be parsed with along
> the lines of:
> ITEM="`echo $GIS_OPT_input | cut -f$NUM -d,`"
for opt in $GIS_OPT_input ; do
As I see it, there isn't actually any point in processing the answers
There isn't any direct way to pass a list of values to the script. The
obvious approach would be to concatenate the answers, separated by a
delimiter. The obvious choice for the delimiter would be a comma, as
that can't occur within any value.
And, AFAICT, concatenating all of the answers using a comma as the
delimiter would produce exactly the same result as just passing the
value of the answer field directly.
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-dev