[GRASS-dev] Possible to use "conditionals" for script options, flags?

Anna Petrášová kratochanna at gmail.com
Fri Nov 21 10:35:26 PST 2014

Hi Nikos,

there is a new parser functionality which allows to specify the
dependencies.There is no documentation, here are the C functions:

recently Glynn added this for python scripts to, i am not sure about the
syntax, perhaps something like this (just guess):
 #% exclusive: -a, -b
 #% requires_all: opt1, opt2, -a

On Fri, Nov 21, 2014 at 11:43 AM, Nikos Alexandris <nik at nikosalexandris.net>

> Scripting in Python and defining options and flags in the header, as usual
> using the '#%' markers in the beginning of the line and following
> g.parser's manual. What if there is need to override an option if another
> one is given?
> For example, an option considered as required may be the "mean target
> altitude" for i.atcorr's parameter file. What if an elevation map is given,
> which renders the previous option not-required?

you can specify that one of  mean target altitude and elevation map is
required (G_option_required) and that they are exclusive
(G_option_exclusive), again, not sure about the Python syntax
> What is the common practice for this? Define both options as optional and
> do the necessary checks inside the script?  Or, is there a way to override
> options if another option is given in the definition-header?
> Thanks, Nikos
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141121/658f1f72/attachment.html>

More information about the grass-dev mailing list