[GRASS-dev] [GRASS GIS] #156: new attribute in Option struct to allow conditional options requirement

#156: new attribute in Option struct to allow conditional options requirement
-------------------------------------------+--------------------------------
Reporter: martinl | Owner: grass-dev@lists.osgeo.org
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: default | Version: svn-trunk
Keywords: parser, required, conditional |
-------------------------------------------+--------------------------------
In some cases "naturally" required parameter cannot be mark as "required"
because there are flags/parameters which don't require that parameter at
all. E.g. r.in.gdal doesn't require for 'f' flag (list supported formats)
any other parameter. Otherwise 'input' is required. To mark 'input' as
required for GRASS parser is counter-productive, user would be forced to
type

{{{
  r.in.gdal -f in=dummy
}}}

instead of

{{{
  r.in.gdal -f
}}}

On the other hand for GUI dialogs is more reasonable to mark visually
'input' as required (for most users can be confusing to see 'input' as
optional when importing data into GRASS). Currently there is not so nice
workaround for that.

{{{
  opt->guisection="Required";
}}}

which puts given parameter to 'Required' tab in GUI dialog.

This can be solved with a new attribute in Option struct which tells the
parser not to worry about testing all required options=. E.g.

{{{
  ...
  input_opt->required=YES;
  ...

  ...
  f_flag->suppress_required=YES;
  ...
}}}

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/156&gt;
GRASS GIS <http://grass.osgeo.org>

#156: new attribute in Option struct to allow conditional options requirement
----------------------+-----------------------------------------------------
  Reporter: martinl | Owner: grass-dev@lists.osgeo.org
      Type: task | Status: new
  Priority: major | Milestone: 7.0.0
Component: default | Version: svn-trunk
Resolution: | Keywords: parser, required, conditional
----------------------+-----------------------------------------------------
Comment (by hamish):

Martin:
> This can be solved with a new attribute in Option struct
> which tells the parser not to worry about testing all required
> options=
..
> f_flag->suppress_required=YES;

i.e. a new attribute in the '''Flag''' struct.

other (shorter) ideas what to call it.....
{{{
flag->runandexit
flag->reqnotreq
flag->skip_req
flag->ignore_req
...
}}}

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/156#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#156: new attribute in Option struct to allow conditional options requirement
----------------------+-----------------------------------------------------
  Reporter: martinl | Owner: grass-dev@lists.osgeo.org
      Type: task | Status: new
  Priority: major | Milestone: 7.0.0
Component: default | Version: svn-trunk
Resolution: | Keywords: parser, required, conditional
----------------------+-----------------------------------------------------
Comment (by glynn):

Replying to [comment:1 hamish]:

> > f_flag->suppress_required=YES;

> other (shorter) ideas what to call it.....

f_flag->modal

I.e. the flag indicates an alternate mode of execution, where the normal
rules about required options don't apply.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/156#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#156: new attribute in Option struct to allow conditional options requirement
--------------------------+-------------------------------------------------
  Reporter: martinl | Owner: grass-dev@…
      Type: task | Status: closed
  Priority: major | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Resolution: fixed | Keywords: parser, required, conditional
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):

  * status: new => closed
  * platform: => Unspecified
  * resolution: => fixed
  * cpu: => Unspecified

Comment:

Solved, closing.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/156#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>