Required Annotation

@Required

The @Required annotation is applied to a field annotated with @Option or @Arguments to indicate that the option/argument must be specified.

@Option(name = "--num",
        arity = 1,
        title = "Number")
@Required
private int number;

When a field is marked with @Required if the user fails to supply that option/argument then an error will be thrown during parsing

If you want to require one option from some set of options then you should use @RequireSome


Improving this Documentation

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.