? [1] ?, the patch attached.
Glynn Clements wrote:
> Maciej Sieczka wrote:
>> P.S.
>>
>> I'm wondering if flags should be exclusive or not in Grass modules, in
>> general.
> It depends upon the nature of the flags; flags should not be mutually
> exclusive unless there is a reason.
>
> Generally speaking, flags which select a particular mode of operation
> may be mutually exclusive if it isn't useful (or practical) to perform
> multiple distinct tasks in a single run (you can always run the
> program once for each mode). OTOH, flags which modify specific aspects
> (e.g. human-readable vs machine-readable output) should operate
> independently of other flags.
>> For example, I asked Jachym to make it possible to his new '-t' flag
>> not to be excluded if used together with '-g', and it works. No matter
>> what flag seqeunce, if both are used, first goes the '-g' output, then
>> '-t'. But maybe I asked him for a wrong thing, maybe flags should be
>> exclusive? Or if they should be not exclusive, should the order they
>> are called metter? Eg. should '-tg' and '-gt' output in the same sequence?
> Flags are either present or absent; a module cannot determine the
> order in which flags are specified.
>
> If you want various items of data output in a specific order, use an
> option with multiple values, e.g. output=region,topology vs
> output=topology,region.
>> Other modules (eg. g.region and r.info) don't allow for using many
>> flags at the same time, and they have some hierachy in excluding them,
>> but I can't find a pattern for that (is there one?).
>>
>> Moreover, I found a strange thing about g.region. Try this:
>>
>> $ g.region -e
>> region north-south extent: 270.000000
>> region east-west extent: 300.000000
>>
>> $ g.region -g
>> n=4916070
>> s=4915800
>> w=602940
>> e=603240
>> nsres=30
>> ewres=30
>> rows=9
>> cols=10
>>
>> BUT A COMBINATION OF BOTH GIVES NEITHER OF THE ABOVE:
>>
>> $ g.region -eg
>> ns_extent=270.000000
>> ew_extent=300.000000
>>
>> The region extent is printed, like if -e alone was used, but instead of
>> "region north-south extent" we get "ns_extent". Same thing, but
>> different wording.
> That makes sense. The -e flag displays the extents, while -g selects a
> machine-readable format. Using both should display the extents in a
> machine-readable format.
Indeed it makes much sense, I get it. Hmm, but then -gc, -gl should
also output in a machine-readable format - but they don't, they still
print like if -c, -l was used alone.
Moreover, g.region description says: "-g Print the current region
(shell script style)". It doesn't mention the fact it can be combined
with other flags to make them print in shell script style - it only
mentions the region.
Given these, how should g.region be fixed then?
I suppose that -g alone should not work at all. Only when combined with
-p,-e,-c,-l it should print their machine-readable version. That would
make things clear and consistent. Of course not a plan for Grass 6.
Grass 7?
> Note that -g is essentially shorthand for -pg; any option which
> selects an output format implies -p unless some other option is given.
That's good to know, but it is not the way it is explained in Description.
> It's arguable that -pe should display the extents as well as the other
> region parameters, and -peg should do likewise but using
> machine-readable format.
I second that.
> Similarly, -lg should display lat/lon boundaries in shell format.
Ditto.
Maciek
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev