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

Smart conflict resolution when two parameters with variable arity compete to consume a positional argument #70

Closed
remkop opened this issue Mar 19, 2017 · 0 comments

Comments

@remkop
Copy link
Owner

remkop commented Mar 19, 2017

Positional parameters with index/arity ranges may make some input ambiguous. In the below example, the argument at index 1 could be either a port or a file.

Example:

class App {
    @Parameters(index = "0..1", arity = "1..2") int[] portRange;
    @Parameters(index = "1..*") String[] files;
}
App app1 = CommandLine.parse(new App(), "3333", "file1", "file2");

This currently gives picocli.CommandLine$ParameterException: Could not convert 'file1' to int[] for parameter[-1]. (Picocli tries to match options in declared order.)

This requires parsing Strings args which may apply until we encounter one that cannot be converted to the target type.

@remkop remkop added this to the 0.5.0 advanced option parsing milestone Mar 19, 2017
@remkop remkop changed the title Support variable arity in positional arguments Smart conflict resolution when two parameters with variable arity vy to consume a positional arguments Apr 25, 2017
@remkop remkop changed the title Smart conflict resolution when two parameters with variable arity vy to consume a positional arguments Smart conflict resolution when two parameters with variable arity vy to consume a positional argument Apr 25, 2017
@remkop remkop changed the title Smart conflict resolution when two parameters with variable arity vy to consume a positional argument Smart conflict resolution when two parameters with variable arity compete to consume a positional argument Apr 25, 2017
@remkop remkop modified the milestones: backlog, 3.0 Apr 10, 2018
@remkop remkop closed this as completed in 0b015c2 Apr 10, 2018
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