Skip to content

How to define an option to accept only one value, but allow to use it multiple times? #190

@RobertZenz

Description

@RobertZenz

I can't figure out how to define an option which does accept only one value but can be specified multiple times. To be exact:

application -o value1 -o value2 parameter1 parameter2

When defined without arity, parameter1 and parameter2 are added to o. I tried this:

@Option(names = { "-o", "--open" }, arity = "1")
private List<String> files = null;

But that disallows multiple usage of -o.

How can I define this?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions