[GRASS-dev] g.mlist list multiple types from all mapsets

Glynn Clements glynn at gclements.plus.com
Thu Jun 19 05:03:05 PDT 2014


Huidae Cho wrote:

> IMO, if we replace g.list with g.mlist, it would be better to remove the -p
> flag and switch between the pretty output and machine-friendly output based
> on isatty(STDOUT_FILENO). In most cases, if the user types a command from
> the terminal without redirecting, they want to *see* output, not *parse*
> it. This way, the new g.list (current g.mlist) will be backward compatible
> *unless* any scripts depend on saved output of the old g.list. Also, we can
> save additional typing.
> 
> But I'm not sure if it's a good idea to print two different outputs based
> on isatty.

I don't think that isatty() should be the sole determining factor. I'd
rather see it used to select a default format but to allow the choice
to be overridden.

E.g. you might want the "pretty" format to still be used if the output
is piped through more, less, pr, etc, but piping will result in stdout
being a pipe rather than a tty.

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


More information about the grass-dev mailing list