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

Arity should not limit the total number of values put in an array or collection #191

Closed
remkop opened this issue Sep 28, 2017 · 0 comments
Closed
Milestone

Comments

@remkop
Copy link
Owner

remkop commented Sep 28, 2017

As of 1.0.1, arity on a list/array field is treated by picocli as a global max.
If more values are put into the list/array for any reason, a MaxValuesforFieldExceededException exception is thrown. This should not happen.

Example

For example, if a collection or array option is defined with arity="1":

class Args {
    @Option(names = "-o", arity="1")
    List<String> strings;
}

Current (incorrect)

Currently picocli (incorrectly) throws an exception if the option is specified multiple times:

<command> -o AA -o BB -o CC
# results in MaxValuesforFieldExceededException ...

Correct

Arity defines the number of parameters that the option takes. The option itself can be specified multiple times:

<command> -o AA -o BB -o CC

assert strings.size() == 3
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

1 participant