Range constraints apply to the values the user enters on the command-line. The range that you specific for the parameter must be of the same type as the argument itself. So a --range
of integers is valid for --type Integer
and a --range
of Strings is valid for --type String
. Values outside of the range will throw an exception.
This example will require the user to enter a value between 20000 and 29999. Ranges are inclusive so 20000 and 29999 are also value.
CmdLine.create("--type integer --key port --range 20000 29999");
> MyProgram --port 21000