Hamish wrote:
> If reading from stdin remains, it will be via -i, although
> I'm inclined to simply remove the feature altogether
> (it doesn't work well the GUI).
I agree that -i is confusing from the auto-gen GUI.
Well; not just confusing. If you run a module from the GUI, and it
expects data from stdin, it's likely to wait forever for input which
will never come. The GUI should explicitly close stdin.
Please keep the ability to pipe rules from stdin. I use it all the time,
both from the command line and within scripts when it is simple enough
that using a temp file would just be a waste.
e.g. the r.colors.stddev addons script.
I would be happy with removing color=rules and the -i flag *if* 'rules=-'
remained to tell it to expect data from stdin.
Note that r.colors doesn't currently understand "rules=-" (although
you can probably use e.g. rules=/dev/stdin).
I can see some advantage to using e.g. "rules=-", as it's easy for the
GUI to prevent this (just require that the answer to any old_file
option exists).
> Reading rules from stdin is a substantial deviation from normal
> behaviour. If this feature remains (and I'm not sure that it should),
> it should be a completely separate flag (i.e. -i), not just
> a particular choice for the color= option.
see also v.in.ascii, r.category, r.reclass, r.what, r.what.color, r.profile, ...
we should allow input from stdin for modules which it is useful, and
we should do so in a standardized way across all modules. I am happy
with the "rules=-" solution; I find adding flags for "expect from
stdin" to be unneeded complication and highly confusing to new GUI
users.
Well, I've just started removing most of the explicitly interactive
stuff.
In the course of that, I've noticed at least one module (r.quant)
which only allows rules from stdin, not from a file. It wouldn't
surprise me if there are others.
We probably want a library function to fopen() an input file, which
returns stdin if "-" is given as the filename. There's still the issue
that any modules which need to seek will only work with a file, not a
pipe.
I wish to make the distinction between removing r.colors "interactive
mode" and removing the ability to pipe from stdin rather than from a
file.
> I'm considering making color=random a separate flag.
example usage?
"ERROR: colors= rules= and -random flag are mutually exclusive"
???
The flag would be equivalent to color=random, so it would exclude with
color= and anything which color= excludes.
OTOH, maybe it should be a separate module.
--
Glynn Clements <glynn@gclements.plus.com>