-
Notifications
You must be signed in to change notification settings - Fork 426
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
Unformatted description configuration in generated help #301
Comments
At the moment, only section headings may contain embedded line separator (%n) format specifiers. For section text (description, header, footer), applications can specify multiple strings, which will be displayed on separate lines. For example: @Command(name = "dump", description = {"Print", "information", "line 3", "line 4"})
class Dump implements Runnable {
//...
} |
I might be missing something since I'm new to the code, but from what I see, when listing Commands:
I would like to give this issue a try. I think formatting |
Thanks for considering contributing to picocli! About your question, let’s keep it simple and stick to just the When testing, please also use a few very long strings, such that even after formatting and splitting lines, some lines exceed the usage help message width. Long lines should be wrapped automatically in the last column of the table in the subcommand list section. But please test this. |
Just to give you an early heads up: I may roll out a release in a week or so. If that’s too soon no problem, the one after that will likely be the 4.0 release. |
Thanks for the heads up. I tried to think of another way of replacing If a user adds the description: |
Thanks for the pull request. To answer your question: It’s fine to use the standard I saw the test in the PR, so when a header containing Also, what about the usage help for that subcommand itself? Does that render the For example, what does the usage help message of the |
Yes, I did test with strings that I split multiple times and even after split span over 2-3 rows. They're wrapped correctly to the right most column.
For |
Would you mind adding unit tests for your findings? |
I added a test, I hope that's what you expected. There's one small inconsistency, usage help does not indent the lines as when listing subcommands. It just prints every line with no whitespace at the beginning. Also, unrelated to my change, usage help now shows the whole command, not as shown in the issue report: |
Format header and description for subcommands
It's been a while since I looked at this code. I now see what you mean with the %s formatting parameters. You are correct. Still, I never was happy with this %s formatting since it is only useful for users who use the Help API directly; it cannot be used via the annotations API or the I am considering removing the parameters in picocli 4.0. |
Merged into master. |
When displaying the generated usage help of a parent command with sub commands, the description configuration is not using format for "%n". The printed description shows the text unformatted:
The following code can be used to replicate the issue:
Version: piclocli 2.3.0
Tks,
The text was updated successfully, but these errors were encountered: