question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unformatted description configuration in generated help

See original GitHub issue

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:

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:closed
  • Created 6 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
remkopcommented, Nov 10, 2018

Merged into master. Thanks again for the pull request!

0reactions
remkopcommented, Nov 10, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found