Menu

Multiple value Arguments

Chris DeGreef

Booleans are the only type that requires no value to be entered. All of the other types require at least one. Using the --multiple property allows you to get more than one value associated with an argument.

--multiple has two parameters for it. The first parameter is the minimum number of values that must be entered. It must be at least the number 1. The second parameter is the maximum number of values that can be entered.

This sets up an argument named "ticker" that allows at least one but no more than 5 tickers to be entered.

CmdLine.create("--type string --key ticker --multiple 1 5");

> MyProgram --ticker IBM GOOG

If --ticker is entered on the command-line then it must have a value, and maybe as many as 5. In this example there obviously are only 2 tickers.


Related

Wiki: Compiling

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.