-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid printing extra new lines at the end of usage and refactor blank lines #592
Conversation
I think having blank lines between the commands helps the reader, particularly with long lists of options and commands. |
Sure thing. How would you like this formatted then? My proposal is:
Which adds a blank line before "Options", "Commands" as well us keeping the original blank line before commands (except the first one). This however means, that there is going to be a blank line before "Options" for commands as well. The original looks like this:
|
LGTM! ❤️ |
Done. Please review and merge at your convenience @mkarg ! |
JCommander currently prints (in my examples) two extra empty lines at the end of usage. This makes the usage output look weird in my opinion.
One comes from a new line inserted by
JCommander
, which is not visible in tests, since those use the usage formatter directly.Another one comes from commands, where the separating empty line was added regardless if there was another command coming.
I initially kept (but fixed) the command separating empty line, but I suggest removing all empty lines. Attached is a PR that removes all empty lines.
If you suggest keeping the empty line between commands, I suggest adding empty lines also after main line usage and options. I made the test code more verbose to see the new style. I also introduced one more test to compare the usage output from
JCommander.usage()
instead of the formatter.