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

ArgGroup validate ignored (4.0.3) #807

Closed
ghost opened this issue Sep 8, 2019 · 5 comments
Closed

ArgGroup validate ignored (4.0.3) #807

ghost opened this issue Sep 8, 2019 · 5 comments
Labels
theme: parser An issue or change related to the parser type: bug 🐛
Milestone

Comments

@ghost
Copy link

ghost commented Sep 8, 2019

With Java 11, Picocli 4.0.3:
I would expect this code to accept '-s -v' as arguments, since validate is set to false:

import picocli.CommandLine;
import picocli.CommandLine.ArgGroup;
import picocli.CommandLine.Option;

public class ArgTest implements Runnable {

    @ArgGroup(validate = false, heading = "%nGlobal options:%n")
    protected GlobalOptions globalOptions = new GlobalOptions();

    static class GlobalOptions {
        @Option(names = "-s", description = "ssss")
        boolean slowClock = false;

        @Option(names = "-v", description = "vvvv")
        boolean verbose = false;
    }

    public static void main(String[] args) {
        new CommandLine(new ArgTest()).execute(args);
    }

    @Override
    public void run() {
    }
}

Instead I get:

Error: -s, -v are mutually exclusive (specify only one)
Usage: <main class> [-sv]

Global options:
  -s     ssss
  -v     vvvv
@remkop remkop added this to the 4.0.4 milestone Sep 8, 2019
@remkop
Copy link
Owner

remkop commented Sep 8, 2019

Thank you for raising this! This certainly looks like a bug. I will take a look.

@remkop remkop closed this as completed in 8023c42 Sep 8, 2019
@remkop
Copy link
Owner

remkop commented Sep 8, 2019

Thanks again for the bug report!
I pushed a fix to master.
Can you verify?

@remkop
Copy link
Owner

remkop commented Sep 8, 2019

I went ahead and included the fix in the picocli 4.0.4 release that I just published to Maven.
Please let me know if there are still any issues.
Thanks again for raising this!

@ghost
Copy link
Author

ghost commented Sep 9, 2019

It certainly solves my use case, awesome! :)

@remkop
Copy link
Owner

remkop commented Sep 9, 2019

Great! If you like the project please star it on GitHub and tell your friends! ;-)

@remkop remkop added the theme: parser An issue or change related to the parser label Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: parser An issue or change related to the parser type: bug 🐛
Projects
None yet
Development

No branches or pull requests

1 participant