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

Parameter validates an unknown option #282

Closed
ghost opened this issue Feb 7, 2018 · 4 comments
Closed

Parameter validates an unknown option #282

ghost opened this issue Feb 7, 2018 · 4 comments
Assignees

Comments

@ghost
Copy link

ghost commented Feb 7, 2018

Using only one field with @Parameter with an arity of "1..*" is considering an unknown option as a valid parameter.

Example to reproduce:

import picocli.CommandLine;
import picocli.CommandLine.Parameters;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class App implements Runnable {
    @Parameters(paramLabel = "FILES", arity = "1..*", description = "List of files")
    private List<File> files = new ArrayList<>();

    // Uncomment to validate @Parameter arity = "1..*",
    //    @CommandLine.Option(names = {"-v"}, description = "Print output")
    //    private boolean verbose;

    public static void main(String[] args) {
        args = new String[]{"-unknown"};

        CommandLine.run(new App(), System.out, args);
    }
    @Override
    public void run() {
        System.out.println("DONE");
    }
}

Excepted:

Return the message of missing required parameters.

@remkop remkop self-assigned this Feb 7, 2018
@remkop
Copy link
Owner

remkop commented Feb 7, 2018

Thanks for the bug report! I was able to reproduce the issue. Still investigating the cause...

remkop added a commit that referenced this issue Feb 7, 2018
@remkop
Copy link
Owner

remkop commented Feb 7, 2018

This is now fixed in branch r2.2.x.
I created a release v2.2.2 for this. The release is available on GitHub now, and should be available on Maven Central and Bintray soon.

Please verify.

@remkop remkop closed this as completed Feb 7, 2018
remkop added a commit that referenced this issue Feb 7, 2018
…id not work when there were no options to compare against

Closes #282
@ghost
Copy link
Author

ghost commented Feb 7, 2018

Fixed. Tks.

remkop added a commit that referenced this issue Feb 7, 2018
remkop added a commit that referenced this issue Feb 7, 2018
@remkop
Copy link
Owner

remkop commented Feb 7, 2018

Thanks for the confirmation and thanks again for the bug report! Keep ‘em coming!

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

No branches or pull requests

1 participant