Global Restrictions

Global restrictions apply over the final parser state and are used to implement restrictions that need to see this final state. The following built-in defaults are provided and used by default for all CLIs and commands unless otherwise specified:

These provide useful default behaviours that most developers will expect from the CLIs they are building.

Selecting the Desired Restrictions

For CLIs you can set the desired restrictions via the restrictions field of the @Cli annotation and control whether the defaults are included via its includeDefaultRestrictions field.

Or you can add the relevant annotations to the class that has the @Cli annotation and they will be automatically detected.

Global Restrictions for Single Commands

This feature requires a minimum version of 2.5.1

For single commands you can specify global restrictions directly on @Command annotated classes and these will be automatically detected appropriately.

Custom Global Restrictions

As with other kinds of restrictions you can create custom Global restrictions if desired, the Custom Restrictions documentation describes the necessary steps for this.


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.