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

Vararg positional parameters should not consume options #285

Closed
remkop opened this issue Feb 11, 2018 · 1 comment
Closed

Vararg positional parameters should not consume options #285

remkop opened this issue Feb 11, 2018 · 1 comment
Milestone

Comments

@remkop
Copy link
Owner

remkop commented Feb 11, 2018

Bug reported in #284: positional parameters with arity = "*" (varargs) will greedily consume the remaining command line arguments, even arguments that are options. This does not follow the specification as described in the Mixing Options and Positional Parameters section of the user manual.

For example, this command:

class Cmd {
    @Option(names = "--alpha") String alpha;
    @Parameters(index = "0", arity = "1") String foo;
    @Parameters(index = "1..*", arity = "*") List<String> params;
}

Given command line arguments like this:

<cmd> foo xx --alpha --beta 

Expected result:

alpha  = --beta
foo    = foo
params = [xx]

Actual result:

cmd.foo == 'foo'
cmd.params == ['xx', '--alpha', '--beta']
@remkop remkop added this to the 2.3 milestone Feb 11, 2018
remkop added a commit that referenced this issue Feb 11, 2018
@remkop
Copy link
Owner Author

remkop commented Feb 13, 2018

Fixed in master and 2.x branch.

@remkop remkop closed this as completed Feb 13, 2018
remkop added a commit that referenced this issue Feb 13, 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