[GRASS-dev] Does g.parser accept 2-byte flags?

Nikos Alexandris nik at nikosalexandris.net
Sun Nov 3 20:14:03 PST 2013


Nikos Alexandris wrote:

> > Is it possible to define a series of flags -cl -ch -mi -ma for a bash
> > shell
> > grass script, that g.parser will understand?

Glynn Clements wrote:

> No. G_parser() (and thus g.parser) follows Unix convention in its
> interpretation of flags, i.e. "-abc" is equivalent to "-a -b -c".
> 
> The double-dash flags (e.g. --quiet) are all hard-coded; it isn't
> possible for a module to define its own.
> 
> If single-character flags aren't suitable for whatever reason,
> consider using a multi-valued option, e.g. "flags=cl,ch,mi,ma".

The reason is ease in understanding (here preferred more than ease of use!):

center low, center high, minimum modulator, maximum modulator, minimum 
modulator 2, maximum modulator 2. Only of low and high as well as only one of 
min and max can be defined at a time. And, then, only of min2 and max2 and 
only if a "-2" flag has been given.

I currently use:
 - l, h (which make sense for low, high
 - i, a for m_i_n and m_a_x... yeah, brilliant idea... I know :-/
 - n, x for mi_n_2 and ma_x_2... another brilliant idea :D

I wonder how you dev's (strategically) select flag letters? Are there always 
some reserved letters?

In any case, thanks for all of the feedback. Nikos


More information about the grass-dev mailing list