jcommander icon indicating copy to clipboard operation
jcommander copied to clipboard

Usage info should be sent to stderr, not stdout

Open lukehutch opened this issue 7 years ago • 2 comments

Currently the usage info is sent to stdout. It should be sent to stderr, by convention.

lukehutch avatar Mar 18 '17 05:03 lukehutch

i would prefer stdout/stderr to be configurable.

i think using java.io.Console in JCommander.getConsole() hinders such implementation, because java.io.Console is initialized with FileDescriptor.out and it is hard coded 😢

yevmel avatar Jun 25 '17 18:06 yevmel

Picocli handles this correctly out of the box: when the user specified invalid input, the error message and usage help should be printed to stderr, but when the user requests help with <cmd> --help, the usage help should be printed to stdout so users can pipe the output to tools like grep and less.

remkop avatar Aug 24 '18 02:08 remkop