[GRASS-dev] Additional switch(es) for <g.mapsets>?

Hamish hamish_b at yahoo.com
Sat Feb 16 16:56:16 PST 2013


Nikos:
> > Would you consider adding an optional "-r" (as "remove")
> > switch to the <g.mapsets> module?

There is already operation=remove available.. ?

> > Or, add an optional switch "-s" or 

fwiw there is already a "-s" switch to launch the selection GUI,


> > Currently, in bash-scripting G7, I try first to remove
> > access to all mapsets but the current (of course) as
> > follows:
> >
> > # one-liner!
> > g.mapsets mapset=$(g.mapsets -p sep=newline | \
> >   grep -v `g.mapset -p` | tr "\n" ",") operation=remove

why not just like:

  g.mapsets mapset=nikos,PERMANENT op=set

?

op=set is a replacing action.


Martin wrote:
> If I understood well, you want something like
> g.mapsets set=<current_mapset>
> ?

note that in many places in grass we have:

  g.mlist mapset=.

to reference the current mapset. That doesn't seem to work in
g.mapsets yet, but it would be pretty easy to add. Then you
could have in your script a generic:

  g.mapsets mapset=.,PERMANENT op=set

if you want to avoid the `eval g.gisenv` step to get the current
$MAPSET name to feed into g.mapsets's mapset= option.


Hamish

ps- should failure to include PERMANENT in a new search path
produce a warning G_message()? (hushed by --quiet)


More information about the grass-dev mailing list