4 ms·
Would a good compromise be to provide -q|--quiet to suppress extra, human readable messages when piping out to a different app?
by smhenderson 10y ago
Would a good compromise be to provide -q|--quiet to suppress extra, human readable messages when piping out to a different app?
- new_hackers 10y agoyes, that would be a good compromise
- dllthomas 10y agoAnother option is looking at isatty. I'm not sure how I feel about either.
- prodigal_erik 10y agoPlease provide a flag that bypasses the isatty check. I use nohup for anything slow or hard to rerun and then tail and/or grep the nohup.out file.
- dllthomas 10y agoYeah, I think that's definitely good advice. isatty can be a good way of deciding which defaults to use, but it shouldn't be the only way of accessing functionality. Note that the flag might say "pretend isatty said yes/no", or there might be a few flags that independently mediate all of the things set based on isatty.
- andrewstuart2 10y agoPersonally, I'd just say use a tab-delimited table by default. And put columns that may contain whitespace last. This way it's human readable and more easily awk/cut parseable. Unfortunately, with e.g. `docker ps`, I can't do as much as I'd like, because it's purely human readable by default. For example: ~ docker ps | awk '{print $7}' PORTS Up ago Up
- deleted 10y ago[deleted]
- skj 10y agoTo suppress the human messages while piping stdin, I add `2> /dev/null`.
- dllthomas 10y agoThere are plenty of times that that's appropriate, but note that it also hides genuine error messages on failure. It's not a good solution for making output less chatty - that's precisely what a `-q` option is for.
- restalis 10y agoIt may be even better to be quiet by default and explicitly turn on the verbose mode when the "extra, human readable messages" are actually needed.