Class to describe one argument. One can be create static instances with constant content. Example:
Argument[] argList =
{ new Argument("", " argument without key on first position", setmethod)
, new Argument("-arg", ":keyed argument", setmethod)
, new Argument("-x", ":the help text", setx)
, new Argument("", " argument without key on any position", setx)
};
- If the
arg
is empty and it is not on the last position, this is a non keyed argument
which is expect on this position in the argument list.
- If the
arg
is not empty, it is the key for the argument. Usual it starts with "-"
but that is not necessary for the algorithm of argument detection. It is only a style of guide
to give arguments. After the argument one of the character '=' or ':' are possible to follow.
But that is not necessary too. If that characters follow, the argument key is taken.
Elsewhere the longest key is detected which is matching. It is possible to request:
"key1value" and "key11value", the longest key detection wins.
- If the
arg
is empty and it is the last Argument[] which is added with MainCmd.addArgument(Argument[])
respectively it is the last entry in MainCmd.argList
, then any argument which does not start
with the given keys are recognized on any position. In this case the distinction between arguments
should be done at user level. For example it may be usual to write "key value key2 value".