Gedalya
2015-Mar-19 08:30 UTC
Patch for "doveadm -f table" nit (was Re: Dovecot current number of connections being used.)
On 03/18/2015 08:49 PM, Timo Sirainen wrote:> There's no reason why flow and pager should write headers to stderr because it would always result only in a mess. 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. 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). > > So, I'll add in my v2.3 TODO that tab formatter should write to stderr..I've been using "-f flow fetch text | sed s/^text=//" when training spamassasin. Couldn't find a straightforward 'fetch raw message'. Seems unnecessarily awkward. Moving headers to stderr would help this, though.
Steffen Kaiser
2015-Mar-19 10:25 UTC
How about an option to disbale headers? (was Re: Patch for "doveadm -f table" nit)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 19 Mar 2015, Gedalya wrote:> On 03/18/2015 08:49 PM, Timo Sirainen wrote: >> There's no reason why flow and pager should write headers to stderr because >> it would always result only in a mess. 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. 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).doveadm .... 2> /dev/null will suppress headers _and_ error messages>> So, I'll add in my v2.3 TODO that tab formatter should write to stderr.. > > I've been using "-f flow fetch text | sed s/^text=//" when training > spamassasin. Couldn't find a straightforward 'fetch raw message'. Seems > unnecessarily awkward. Moving headers to stderr would help this, though. >How about a formatter option to enable/disable headers at all? Like, who -H ps h ps --headers Most probably it useful for scripts only, so add an option to suppress all headers will fit most case. - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEVAwUBVQqkK3z1H7kL/d9rAQJ/cwgApl5SvuwOcLTDqn0X/A9pCCQvuzX50oyW FZH43AzCVcAShxX5SE8wRhmxTfI71mjQrJkvQu1zbCfh7FAY5lNP7dtTNWZRCxtI PG1B5qfHrB/56SdnEqckYNysrF8XSoKi+0mCzzB3GaSbAWeahvVu93qh1OItfDiA 5Ago3v9l2SlJq/TM9Bo54P5jwemgI9jg9t+5PHBF7RMJY1eQ1Dd4E4IoO/PnqnzX IKL2Xgp3YBm7eNksQWsSowfPntgb56UfLQZrQWG+7pjkDpDsKxZxTStAYcVIH6pj //vTYrDnQP0JPwMe2iqhhrl3NyK4Wk7R1obWcezEcXhxEKFP5fn/Vg==m6yz -----END PGP SIGNATURE-----
Willem Jan Withagen
2015-Mar-19 10:51 UTC
Patch for "doveadm -f table" nit (was Re: Dovecot current number of connections being used.)
On 19-3-2015 9:30, Gedalya wrote:> On 03/18/2015 08:49 PM, Timo Sirainen wrote: >> There's no reason why flow and pager should write headers to stderr >> because it would always result only in a mess. 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. 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). >> >> So, I'll add in my v2.3 TODO that tab formatter should write to stderr.. > > I've been using "-f flow fetch text | sed s/^text=//" when training > spamassasin. Couldn't find a straightforward 'fetch raw message'. Seems > unnecessarily awkward. Moving headers to stderr would help this, though.I think that that is sort of forgoing the pupsoe of stderr. Moving things to stderr for reasons of parsing and other trivia, just complicates other sysadmin scripts where it is expected that only errors are written to stderr. I would suggest to write all std-info just to regular stdout, and deal with reporting tools just there. just my 2 cts, --WjW
Timo Sirainen
2015-Mar-20 18:47 UTC
How about an option to disbale headers? (was Re: Patch for "doveadm -f table" nit)
On 19 Mar 2015, at 12:25, Steffen Kaiser <skdovecot at smail.inf.fh-brs.de> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Thu, 19 Mar 2015, Gedalya wrote: >> On 03/18/2015 08:49 PM, Timo Sirainen wrote: >>> There's no reason why flow and pager should write headers to stderr because it would always result only in a mess. 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. 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). > > doveadm .... 2> /dev/null > will suppress headers _and_ error messagesHm. Yeah, that's not good.>>> So, I'll add in my v2.3 TODO that tab formatter should write to stderr.. >> >> I've been using "-f flow fetch text | sed s/^text=//" when training spamassasin. Couldn't find a straightforward 'fetch raw message'. Seems unnecessarily awkward. Moving headers to stderr would help this, though. >> > > How about a formatter option to enable/disable headers at all? Like, > > who -H > ps h > ps --headers > > Most probably it useful for scripts only, so add an option to suppress all > headers will fit most case.I guess that would be best. Added -h parameter now to hg. I didn't change the stdout/stderr behavior for now - have to wait until v2.3 for that. I guess that could also be changed to stdout then.
Possibly Parallel Threads
- How about an option to disbale headers? (was Re: Patch for "doveadm -f table" nit)
- How about an option to disbale headers? (was Re: Patch for "doveadm -f table" nit)
- Patch for "doveadm -f table" nit (was Re: Dovecot current number of connections being used.)
- How about an option to disbale headers? (was Re: Patch for "doveadm -f table" nit)
- Patch for "doveadm -f table" nit (was Re: Dovecot current number of connections being used.)