On Thu, 19 Mar 2015, Timo Sirainen wrote:
You have to redirect stderr to /dev/null because that's where the first header line is written to. The default format style (table) is inconsistent with the other formats (flow,pager,tab) that write headers and data to stdout.
There's no reason why flow and pager should write headers to stderr because it would always result only in a mess.
Right.
But instead of changing table headers to write to stdout, I think a better fix would be to make tab formatter write headers to stderr.
That would at least make the behaviour consistent.
Including headers in stdout makes it more difficult to write scripts that access the actual data. For example now you can do "doveadm who -1 | sort" and the output will work. If headers were written to stdout you'd have to make it more complicated. Also you can now easily specify what you want to do with the headers, 2>/dev/null if you don't care about them or 2>&1 if you want to include them in stdout (which works even after |sort).
I agree with the easier parsing thing for scripts. It just a little weird when you're doing piping interactively and the header pops out. Another option is to add another flag/formatter that will squelch headers.
I'm cool with whatever you implement.
Joseph Tam <jtam.home@gmail.com>