Unformatted description configuration in generated help
See original GitHub issueWhen 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:
Commands:
dump %nPrint %ninformation.
The following code can be used to replicate the issue:
public class Demo {
@Command(name = "main", description = "%nPrint information.", subcommands = Dump.class)
static class MainCommand implements Runnable {
@CommandLine.Option(names = {"-h", "--help"}, usageHelp = true, description = "Print this help message.")
private boolean showHelp;
public void run() {
System.out.println("main command");
}
}
@Command(name = "dump", description = "%nPrint %ninformation.")
static class Dump implements Runnable {
@ParentCommand
private MainCommand parent;
@CommandLine.Option(names = {"-h", "--help"}, usageHelp = true, description = "Print this help message.")
private boolean showHelp;
@Override
public void run() {
System.out.println("sub command");
}
}
public static void main(String[] args) {
test1();
//test2();
}
public static void test1() {
CommandLine.run(new MainCommand(), System.out, "-h");
/*
Usage: main [-h]
Print information.
-h, --help Print this help message.
Commands:
dump %nPrint %ninformation.
*/
}
public static void test2() {
CommandLine.run(new MainCommand(), System.out, "dump", "-h");
/*
Usage: dump [-h]
Print
information.
-h, --help Print this help message.
*/
}
}
Version: piclocli 2.3.0
Tks,
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
What is configuration file? | Definition from TechTarget
A configuration file, often shortened to config file, defines the parameters, options, settings and preferences applied to operating systems (OSes), ...
Read more >Properly configuring server MIME types - MDN Web Docs
Properly configuring server MIME types. MIME types describe the media type of content, either in email, or served by web servers or web ......
Read more >Command line process auditing | Microsoft Learn
Description /Help: This security policy setting determines whether the operating system generates audit events when a process is created ...
Read more >Debugging in Visual Studio Code
One of the great things in Visual Studio Code is debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >Troubleshoot issues with Gmail signatures - Google Support
An email signature is text, like your contact information or a favorite quote, ... If you can't format your signature text, and Plain...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Merged into master. Thanks again for the pull request!
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
UsageMessageSpec
programmatic API. #526 is a better approach, I think.I am considering removing the parameters in picocli 4.0.