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

required parameter does not exclude negated options #1197

Closed
keturn opened this issue Sep 30, 2020 · 3 comments
Closed

required parameter does not exclude negated options #1197

keturn opened this issue Sep 30, 2020 · 3 comments
Milestone

Comments

@keturn
Copy link

keturn commented Sep 30, 2020

Given code like this:

    @Option(names = "--crash-report", defaultValue = "true", negatable = true)
    private boolean crashReportEnabled;

    @Option(names = "--homedir")
    private Path homeDir;

if invoked with --homedir --crash-report, it quits as expected with this message:

Expected parameter for option '--homedir' but found '--crash-report'

But if invoked with the boolean option's negated form --homedir --no-crash-report it assigns --no-crash-report as the value of homeDir.

using picocli and picocli-codegen version 4.5.1.

@remkop
Copy link
Owner

remkop commented Oct 1, 2020

Thank you for reporting this!
That looks like a bug. Looking into it.

@remkop remkop closed this as completed in 4ef6bd4 Oct 3, 2020
@remkop
Copy link
Owner

remkop commented Oct 3, 2020

Sorry for the delay.
I found the cause and pushed a fix to master.
This fix will be included in the next release.
Thanks again for raising this!

@remkop
Copy link
Owner

remkop commented Oct 14, 2020

Picocli 4.5.2, which contains the fix for this issue, has been released.
Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants