-
Notifications
You must be signed in to change notification settings - Fork 418
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
Problematic formatting: descriptions containing newlines #430
Comments
Same as with #429: Also, I couldn't find any documentation on how multiple descriptions are handled by picocli rather than a single one with newlines in it. |
…wlines) in the subcommands list descriptions
I've pushed a fix for this to master. Can you build the project and try it? I was in a rush and did not have time to create a unit test yet. Can you provide one (or some code snippets that help me reproduce the original problem)? You can just paste some of the code you used to test in a comment here - would be very helpful! |
Simple Java Mail salutes you; it works. I'll see what I can do about that junit test. Providing the code I used for this is a little problematic. I'm translating from a Java builder API to an intermediate model which is then translated to a picocli command structure. I'll see if I can provide a simple demo. |
This shows the bug with the current latest version in Maven, which is solved by the change you made: private static void runTest() {
CommandSpec rootCmd = createCmd("newlines", "Displays subcommands, one of which contains description newlines");
rootCmd.addSubcommand("subA", createCmd("subA", "regular description for subA"));
rootCmd.addSubcommand("subB", createCmd("subB", "very,\nspecial,\nChristopher Walken style,\ndescription."));
rootCmd.addSubcommand("subC", createCmd("subC", "regular description for subC"));
CommandLine.ParseResult pr = new CommandLine(rootCmd).parseArgs("--help");
CommandLine.printHelpIfRequested(pr.asCommandLineList(), out, err, Ansi.AUTO);
}
private static CommandSpec createCmd(String name, String description) {
CommandSpec cmd = CommandSpec.create()
.name(name)
.mixinStandardHelpOptions(true);
cmd.usageMessage()
.description(description);
return cmd;
} Speaking of which, is the current GitHub source stable? I tend to give my library users the freedom to upgrade maven dependencies in case some breaking bug or security issue is solved. That's why I prefer relying on maven releases... |
Thanks for the test! The master branch is continuously modified. I’ll release a new version that includes this fix in the next few days. |
FYI: picocli is on maven: https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22picocli%22 |
Yeah, was already using that. But since you advocate including the entire file in projects, I thought you might have a stable master or something (or an LTS branch). |
Good point. I should point to a release tag. |
On a side note, do you know of a terminal in Windows 10 that renders ANSI codes properly? Currently tried cmd, Powershell and ConEmu. |
Have you tried Cygwin? That looks quite pretty and even shows italic. |
picocli 3.5 has been released which includes the fix for this issue. You may also like the |
When I create a command description, newlines work perfectly when directly triggered with --help:
However, when it is shown for a parent command on which --help was triggered and shown in the list under Commands:, it breaks the flow completely (I tried with \n and %n):
See that Note 1, 2 and 3? Is there a solution for this?
The text was updated successfully, but these errors were encountered: