@MaxOccurrences
The @MaxOccurrences
annotation is used to indicate that an @Option
or @Arguments
may be specified at most some number of times.
@Option(name = "--name",
arity = 1,
title = "Name")
@MaxOccurrences(occurrences = 2)
private List<String> name;
Here we specify that the --name
option can be provided at most twice. If the option is provided too many times then an error will be thrown during parsing.
To specify the minimum number of occurrences use the @MinOccurrences
annotation. You can use both this and @MinOccurrences
to set both a minimum and maximum occurrences if you wish.
If you want an option to occur at most once then use the @Once
annotation, if you want to require that the option occur then use the @Required
annotation.
This documentation is itself open source and lives in GitHub under the docs/ directory.
I am not a professional technical writer and as the developer of this software I can often make assumptions of
knowledge that you as a user reading this may not have. Improvements to the documentation are always welcome, if you
have suggestions for the documentation please submit pull requests to the main
branch.