[GRASS-dev] g.mlist syntax vs g.mremove syntax

Glynn Clements glynn at gclements.plus.com
Tue Oct 14 07:42:36 EDT 2008


Markus Neteler wrote:

> this syntax is easy to remember:
>  g.mremove rast=gpcp_1dd_p1d.*.* [-f]
> 
> while
>  g.list type=rast
>  g.mlist type=rast pattern=gpcp_1dd_p1d.*.*
> is less so.
> 
> Certainly this works
>  g.list rast
>  g.mlist rast pattern=gpcp_1dd_p1d.*.*
> however, the syntax behind is more complicated than
> for g.[m]remove.
> 
> Can we simplify to
>  g.mlist rast=gpcp_1dd_p1d.*.*
> in GRASS 7?

Can we? Yes. Should we? I'm not so sure. One option for the type and
another for the pattern seems cleaner to me than a separate option for
each type.

IOW, I think that it's g.mremove (and g.remove, g.copy, g.rename)
which got it wrong. I'm aware that having a separate option for each
type means less typing, but that isn't necessarily the most important
factor. The g.list/g.mlist interface makes for a smaller (and arguably
simpler) GUI dialog.

AFAICT, the g.mremove (etc) interface is basically a fudge to get
around the restriction that the parser only allows a single
"positional" parameter, and requires keywords for the rest. You can't
just use e.g.:

	g.mlist rast gpcp_1dd_p1d.*.*

but you can "fudge" it to:

	g.mlist rast=gpcp_1dd_p1d.*.*

by having a separate option for each type.

I'm aware that using separate options means that you can perform
multiple remove/rename/copy operations in a single command. But I
wouldn't expect that usage to be particularly common, and listing
multiple types (using the same pattern) is likely to be even less
common.

If the brevity issue is a genuine consideration, it would be better
(IMHO) to extend the parser to allow more than option to be specified
by position, e.g.

	g.mlist rast gpcp_1dd_p1d.*.*

would be permitted, and equivalent to:

	g.mlist type=rast pattern=gpcp_1dd_p1d.*.*

> (In the same moment, maybe merge g.list and g.mlist?)

So, if you change g.mlist to use the g.mremove (etc) interface, what
would be the equivalent of "g.list rast" in the merged version?

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list