[GRASS-dev] Adding an expert mode to the parser

Vaclav Petras wenzeslaus at gmail.com
Wed Sep 28 18:26:58 PDT 2016


On Wed, Sep 28, 2016 at 4:35 PM, Markus Metz <markus.metz.giswork at gmail.com>
wrote:

> On Tue, Sep 27, 2016 at 5:55 PM, Vaclav Petras <wenzeslaus at gmail.com>
> wrote:
> >
> > On Mon, Sep 26, 2016 at 5:50 PM, Vaclav Petras <wenzeslaus at gmail.com>
> wrote:
> >>
> >> If the --help is just for scanning and the issue is that it simply too
> >> long, hiding some parameters is not the only option we have. For many
> (and
> >> more in the future hopefully) parameters we have (short) label and
> (longer)
> >> description. --help prints both (if both are present, that's at least 2
> >> lines per parameter). Additionally, if the option has predefined values
> >> which have descriptions, there is one line for each of those. So, the
> >> question is would it be helpful (at least as a first step) if --help
> would
> >> print less information for each parameter but still provided all
> parameters?
> >
> >
> > Additionally, the label and description is also for the module itself, so
> > when we have label, we don't need to show description, that's -1 line for
> > r.slope.aspect. Then we can remove keywords, that's -3 lines. Then we
> have
> > the standard/long flags. (These might be similar to the general options
> from
> > `ogr2ogr --help-general` which Madi posted.) They are the same all the
> time,
> > except for --o, so that's -4 or -3 for the old ones (depending on module)
> > and -2 for the recently added flags (--qq --ui). They still can be in
> > `Usage:` section or they may not. There is also an empty line at the
> > beginning, we can remove it as well because don't go for beauty and the
> > `Description:` title is also not necessary, so we could remove that as
> well,
> > that's -2 lines. That would be 12 lines total. (I have 55 lines in the
> > terminal windows I'm using right now, so 12 seems to be quite a lot).
>
> +1


Done in r69602. I limited the changes to the usage() function (G_usage()
backend). The behavior is driven by 3 variables which can become function
parameters in the future. For now, full description can be found in the
using man or g.manual commands. Some --full-help can be implemented if
desired. Related to that, I did not preserved the functionality of
--help-text, this can be fixed as well.

Next step would be ensuring that each module has its label (or description)
short enough that it fits into one line (72 characters?). Similarly, each
option and flag should have label (or description) which fits on one line
considering that we need some space for flag, option name and horizontal
spacing.

Anyway, here is the state before:

> r.slope.aspect --help 2>&1 | wc
     48     255    2137
> v.in.lidar --help 2>&1 | wc
     72     462    3634

And after:

> r.slope.aspect --help 2>&1 | wc
     32     194    1620
> v.in.lidar --help 2>&1 | wc
     43     242    2002

Please test,
Vaclav


https://trac.osgeo.org/grass/changeset/69602
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20160928/613eceaa/attachment.html>


More information about the grass-dev mailing list