zirias@
Developer
I have a very simple question: For a tool that offers verbose help (using
There's of course a bit of background, I'm currently developing some "generic" configuration helpers for my "poser" project, still working on parsing configuration from the command line, and once this is finished, I plan to add support for configuration files (and both parsers should be stackable).
I already added a few convenience features, the lib can already auto-generate both "usage" and "help" messages from the configuration description. There are functions to write them to any
Finally, I added another feature I kind of liked when I've seen it used by
Now, this leads to an interesting surprise for the user. If output would go to stdout, all that would be needed to disable this auto-paging would be e.g.
Therefore, I now wonder whether help output should better go to stdout by default? For the short "usage" output, it's a different thing, as this is typically triggered by parsing/validation errors, so you actually have some error condition. But to get the help output, you explicitly write some flag to get it. So, would it make more sense to direct it to stdout instead by default?
-h
or --help
flags), should this help go to stdout or stderr?There's of course a bit of background, I'm currently developing some "generic" configuration helpers for my "poser" project, still working on parsing configuration from the command line, and once this is finished, I plan to add support for configuration files (and both parsers should be stackable).
I already added a few convenience features, the lib can already auto-generate both "usage" and "help" messages from the configuration description. There are functions to write them to any
FILE *
the user wants. I also added a short-hand convenience function to add a "standard" flag that will automatically print the help message. So far, this automatic flag will print it to stderr.Finally, I added another feature I kind of liked when I've seen it used by
git
: Generated output, only if it goes to an actual terminal, will be piped to $PAGER
instead if it wouldn't fit into the current dimensions of that terminal (as an optional feature, must be explicitly enabled by the caller).Now, this leads to an interesting surprise for the user. If output would go to stdout, all that would be needed to disable this auto-paging would be e.g.
| cat
. But as help output goes to stderr right now, to disable the auto-paging in a similar way, you'd have to e.g. write 2>&1 | cat
instead.Therefore, I now wonder whether help output should better go to stdout by default? For the short "usage" output, it's a different thing, as this is typically triggered by parsing/validation errors, so you actually have some error condition. But to get the help output, you explicitly write some flag to get it. So, would it make more sense to direct it to stdout instead by default?