Skip to content
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

attribute splitSynopsisLabel: incorrect usage message #1044

Closed
deining opened this issue May 14, 2020 · 2 comments
Closed

attribute splitSynopsisLabel: incorrect usage message #1044

deining opened this issue May 14, 2020 · 2 comments
Labels
theme: usagehelp An issue or change related to the usage help message type: bug 🐛
Milestone

Comments

@deining
Copy link
Contributor

deining commented May 14, 2020

Picocli 4.3.0 introduced the attribute splitSynopsisLabel, which is great.
I encountered a minor issue when trying out the new attribute:

1  package test;
2  import picocli.CommandLine;
3  import picocli.CommandLine.Command;
4  import picocli.CommandLine.Option;
5
6  public class ExecuteTest {
7   
8      static CommandLine cmd;

9      public static void main(String[] args) {
10       cmd = new CommandLine(new TestCommand());
11       cmd.usage(cmd.getOut());
12     }
13 
14    @Command(name = "ExecuteTest")
15     static class TestCommand implements Runnable {
16       
17      @Option(names = "x", split="\\|", splitSynopsisLabel = "|")
18         static String[] parts = {};
19 
20         @Override
21         public void run() {
22             }
23         }
24     }
25 }

This now results in a proper usage message:

Usage: ExecuteTest [x=<parts>[|<parts>...]]...

Now I remove the attribute split from the option while leaving the the attribute splitSynopsisLabel in place:

17 @Option(names = "x", splitSynopsisLabel = "|")

I'm still getting the same usage message (which is incorrect now):

Usage: ExecuteTest [x=<parts>[|<parts>...]]...

I see two possible remedies:

  • when using attribute splitSynopsisLabel, check whether corresponding attribute split is given, throw an exception in case of missing attribute
  • print corrrect usage message if split attribute is missing
@remkop remkop added this to the 4.3.1 milestone May 14, 2020
@remkop remkop added type: bug 🐛 theme: usagehelp An issue or change related to the usage help message labels May 14, 2020
remkop added a commit that referenced this issue May 14, 2020
@remkop
Copy link
Owner

remkop commented May 14, 2020

Thank you for raising this!
This is now fixed in master (splitSynopsisLabel is ignored if split is missing).

If no other issues are reported I will do a bugfix release tomorrow morning.

@remkop remkop closed this as completed May 14, 2020
@remkop
Copy link
Owner

remkop commented May 14, 2020

@deining picocli 4.3.1 has been released with this fix. Thanks again for raising this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: usagehelp An issue or change related to the usage help message type: bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants