[GRASS-dev] g.mapsets revision 30712

  r30712 | martinl | 2008-03-24 11:19:11 +0000 (Mon, 24 Mar 2008) | 2 lines
  g.mapsets: (cosmetics) message cleaning, some minor changes in manual, tcl/tk-related code removed

Presumably g.mapsets.tcl should be removed, now that it is no longer
used.

Also, I've removed the code which was commented-out.

In general, code should be removed altogether rather than being
disabled (and #if 0/#endif is preferable to commenting). If someone
wants to resurrect the old code, they can get and old version from
SVN.

The only reason to leave unused code in is if it needs to be disabled
temporarily, e.g. if it doesn't work but you can't figure out how to
fix it.

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

Glynn Clements wrote:

  r30712 | martinl | 2008-03-24 11:19:11 +0000 (Mon, 24 Mar 2008) | 2 lines
  g.mapsets: (cosmetics) message cleaning, some minor changes in manual,
tcl/tk-related code removed

Presumably g.mapsets.tcl should be removed, now that it is no longer
used.

The CMD line version of g.mapsets is lacking a parameter to
remove (multiple) mapsets from the search path.

This should be added before removing the Tcl version.
I tried but got lost in the tokenizer.

Markus
--
View this message in context: http://www.nabble.com/g.mapsets-revision-30712-tp16273660p16499199.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Hi,

2008/4/4, Markus Neteler OSGeo <neteler@osgeo.org>:

> r30712 | martinl | 2008-03-24 11:19:11 +0000 (Mon, 24 Mar 2008) | 2 lines
> g.mapsets: (cosmetics) message cleaning, some minor changes in manual,
> tcl/tk-related code removed

Glynn:

> Presumably g.mapsets.tcl should be removed, now that it is no longer
> used.

The CMD line version of g.mapsets is lacking a parameter to
remove (multiple) mapsets from the search path.

This should be added before removing the Tcl version.
I tried but got lost in the tokenizer.

try the attached patch (for review), Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

g-mapsets-del.diff (1.65 KB)

Markus Neteler OSGeo wrote:

> r30712 | martinl | 2008-03-24 11:19:11 +0000 (Mon, 24 Mar 2008) | 2 lines
> g.mapsets: (cosmetics) message cleaning, some minor changes in manual,
> tcl/tk-related code removed
>
> Presumably g.mapsets.tcl should be removed, now that it is no longer
> used.

The CMD line version of g.mapsets is lacking a parameter to
remove (multiple) mapsets from the search path.

Can you test the attached patch?

This should be added before removing the Tcl version.
I tried but got lost in the tokenizer.

The point is that r30712 removed the code which runs the Tcl front-end
when g.mapsets is invoked without arguments. There isn't much point in
having the Tcl code when it will never be run.

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

(attachments)

g.mapsets-removemapset.diff (1.46 KB)

Martin Landa wrote:

2008/4/4, Markus Neteler OSGeo <neteler@osgeo.org>:
> > r30712 | martinl | 2008-03-24 11:19:11 +0000 (Mon, 24 Mar 2008) | 2 lines
> > g.mapsets: (cosmetics) message cleaning, some minor changes in manual,
> > tcl/tk-related code removed
Glynn:
> > Presumably g.mapsets.tcl should be removed, now that it is no longer
> > used.

> The CMD line version of g.mapsets is lacking a parameter to
> remove (multiple) mapsets from the search path.
>
> This should be added before removing the Tcl version.
> I tried but got lost in the tokenizer.

try the attached patch (for review), Martin

I should probably have read this message before going ahead and making
my own patch as soon as I read Markus' message.

FWIW:

+ opt3->key = "delmapset" ;

I was going to call the option that, then decided that "remove" is
more accurate than "delete".

Also, I'm not sure what the policy is (or even if there is a policy)
on using abbreviations in option names. For a single word, it's normal
to used the complete word, as option names can be abbreviated. For
multiple words, it's more awkward.

If it wasn't for the fact that addmapset= already exists, it would
have been better to just have add= and remove= (or delete=). The
"mapset" in the option names is redundant, IMHO.

In the end, I went for removemapset=. For interactive command-line
use, I would expect the user to abbreviate it to "rem=" anyhow.

+ tokens = G_tokenize (opt3->answer, ",");

This isn't necessary. When ->multiple == YES, the parser will split
the ->answer string into components which are stored in the ->answers
array (see the code for the other options).

+ G_verbose_message(_("Mapset <%s> removed from search path"),
+ oldname);

If this is desirable, should the addmapset= option have something
similar?

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

Glynn wrote:

FWIW:

> + opt3->key = "delmapset" ;

I was going to call the option that, then decided that "remove" is
more accurate than "delete".

agreed

Also, I'm not sure what the policy is (or even if there is a policy)
on using abbreviations in option names. For a single word, it's normal
to used the complete word, as option names can be abbreviated. For
multiple words, it's more awkward.

I expect understanding options for non-English speakers is hard enough,
trying to decipher abbreviated English option names would be much worse.
IMO underscores are nice between words for readability, but which ever
way is chosen, consistency is more important.

Lower case seems to be standard for options (exception: r.terraflow [fix
for GRASS 7])
There are some old modules (r.stats) which use upper case for flags.

If it wasn't for the fact that addmapset= already exists, it would
have been better to just have add= and remove= (or delete=). The
"mapset" in the option names is redundant, IMHO.

agreed. maybe flag in the code as something for GRASS 7.

      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

Hamish wrote:

> Also, I'm not sure what the policy is (or even if there is a policy)
> on using abbreviations in option names. For a single word, it's normal
> to used the complete word, as option names can be abbreviated. For
> multiple words, it's more awkward.

I expect understanding options for non-English speakers is hard enough,
trying to decipher abbreviated English option names would be much worse.
IMO underscores are nice between words for readability, but which ever
way is chosen, consistency is more important.

I would have added the underscore, but addmapset= didn't have it.

I have been wondering whether it would be worth crafting an algorithm
which can handle abbreviating multi-word options. E.g. if the option
was named remove_map_set, you could use any combination of prefixes,
e.g. rem, rms, remms, etc. That should eliminate the need to use
abbreviations in option names.

Lower case seems to be standard for options (exception: r.terraflow [fix
for GRASS 7])
There are some old modules (r.stats) which use upper case for flags.

That's consistent with most other programs. E.g. programs which use
getopt_long() normally use lower case for --long-options and both
lower and upper case for single-character switches (particularly if
there are a lot of them).

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

On Sat, Apr 5, 2008 at 1:16 AM, Glynn Clements <glynn@gclements.plus.com> wrote:

Martin Landa wrote:

> 2008/4/4, Markus Neteler OSGeo <neteler@osgeo.org>:
> > > r30712 | martinl | 2008-03-24 11:19:11 +0000 (Mon, 24 Mar 2008) | 2 lines
> > > g.mapsets: (cosmetics) message cleaning, some minor changes in manual,
> > > tcl/tk-related code removed
> Glynn:
> > > Presumably g.mapsets.tcl should be removed, now that it is no longer
> > > used.
>
> > The CMD line version of g.mapsets is lacking a parameter to
> > remove (multiple) mapsets from the search path.
> >
> > This should be added before removing the Tcl version.
> > I tried but got lost in the tokenizer.
>
> try the attached patch (for review), Martin

I should probably have read this message before going ahead and making
my own patch as soon as I read Markus' message.

Thanks for your quick replies!
Please submit the final version for testing to SVN...

Markus