Package nl.colorize.util.cli
Annotation Interface Arg
Annotates a field to represent one of the arguments in a command line
interface. Used in conjunction with
CommandLineArgumentParser
.-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionString[]
List of alternative names for this argument.The command line argument's default value that is used when no value for the argument has been provided.The command line argument name.boolean
Indicates whether this is a required command line argument.Optionally returns usage information, which is printed when no value or an invalid value for the argument is provided.
-
Element Details
-
name
String nameThe command line argument name. If not specified, the field name will also act as the argument name. The argument name is normalized, so a name like "outputDir" will match different variants like "--outputDir", "--outputdir", "-outputdir", and "-output-dir".- Default:
"$$default"
-
aliases
String[] aliasesList of alternative names for this argument. Whilename()
represents this argument's "primary" name, using aliases can be used for things like shorthand versions, or backward compatibility when renaming arguments.- Default:
{}
-
required
boolean requiredIndicates whether this is a required command line argument. When false, the argument is considered optional. Failing to provide the argument will result in the default value returned bydefaultValue()
, ornull
if no default value has been specified.- Default:
true
-
defaultValue
String defaultValueThe command line argument's default value that is used when no value for the argument has been provided. If a default value is specified, the argument is considered optional. If not, the argument is considered mandatory.Boolean flags are always considered optional, with a default value of false. Attempting to define a default value for a boolean argument will therefore be ignored.
- Default:
"$$default"
-
usage
String usageOptionally returns usage information, which is printed when no value or an invalid value for the argument is provided.- Default:
""
-