More features
There are much more options available than are described in this tutorial.
The following list should not be considered exhaustive:
-
A command line can also have 'normal' arguments, i.e.,
arguments that are not options. They can be read using
the method getRemainingArguments
of CLManager
.
-
Options methods can have zero or more parameters of any type.
J-Clops knows how to process string parameters, parameters of primitive type
and all enum
type parameters (check this out!). If this is not sufficient for your needs, you can
define and register your own argument parsers for any other type you care to name.
-
We have already mentioned this in passing, but it is important enough
to be repeated here: Options Are Inherited. If you have many programs
that use (almost) the same set of command line options, you can make their
option contexts inherit from a common super class.
-
Also varargs option methods are supported.
-
You can attach a priority to each option method,
which determines the order in which the options are processed.
-
The automatically generated usage message usually lists the options
in alphabetical order. You can however change this order by indicating
a usage rank for the option.
-
By default, the same option can be present at most once on
the same command line, but you can change this by
using the @Repeatable
annotation on the option method.
-
...
Further information can be found in the API documentation. Enjoy!