On Wed, May 13, 2015 at 9:47 AM, Pietro <peter.z...@gmail.com> wrote:
>
> Hi Martin,
>
> On Wed, May 13, 2015 at 11:08 AM, Martin Landa <landa.mar...@gmail.com>
wrote:
> > Hi,
> >
> > 2015-05-13 8:03 GMT+02:00 Pietro <peter.z...@gmail.com>:
> >> #% description: Name of vector map with interested segments of rivers
> >
> > <- label
>
> Therefore I should use label instead of description, something like:
>
> {{{
> #!/usr/bin/env python
> # -- coding: utf-8 --
> #%module
> #% description: Test
> #% keywords: test
> #%end
> #%option G_OPT_R_INPUT
> #% key: discharge
> #% label: Name of river discharge [m3/s]
> #% required: yes
> #%end
> #%option G_OPT_V_INPUT
> #% key: river
> #% label: Name of vector map with interested segments of rivers
> #% required: yes
> #%end
> from __future__ import print_function
> import sys
>
> # import grass libraries
> from grass.script import core as gcore
>
>
> def main(opts, flgs):
>     print(opts, flgs)
>
> if __name__ == "__main__":
>     options, flags = gcore.parser()
>     sys.exit(main(options, flags))
> }}}
>
> The GUI is now fine and the command output looks:
>
> {{{$ r.example --h
>
> Description:
>  Test
>
> Keywords:
>  test
>
> Usage:
>  r.example discharge=name river=name [--help] [--verbose] [--quiet]
>    [--ui]
>
> Flags:
>  --h   Print usage summary
>  --v   Verbose module output
>  --q   Quiet module output
>  --ui  Force launching GUI dialog
>
> Parameters:
>   discharge   Name of river discharge [m3/s]
>                Name of input raster map
>       river   Name of vector map with interested segments of rivers
>                Or data source for direct OGR access
> }}}
>
>
> >> As you can see the description of the parameter add the default
> >> description set in G_OPT_V_INPUT and in a new line the description
> >> added manually in the definition of the module parameters. Instead the
> >> G_OPT_R_INPUT shows only the description set manually.
> >
> > right, G_OPT_V_INPUT has defined both label and description [1]. This
> > the source of inconsistency. There are more standard options which
> > defines both label and description.
>
> Do you think this inconsistency should be fix, or just reported
> somewhere on a Wiki page?

Perhaps all standard options should define both label and description and
you can then modify whatever suits you. (I often end up setting both.)

In the future, we should revise this anyway, like move from description to
label as the primary one or making both mandatory.

> All the best.
>
> Pietro
> _______________________________________________
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to