This library is parser of command line option.
Sorry, api document is only Japanese.
License is GNU GPL(GNU General Public License).
link about GPL
from GPL FAQ.
Q. In an object-oriented language such as Java, if I use a class that is GPL'ed without modifying, and subclass it, in what way does the GPL affect the larger program?
A. Subclassing is creating a derivative work. Therefore, the terms of the GPL affect the whole program where you create a subclass of a GPL'ed class.
Java 2 SDK 1.3 or higher
Download ArgsParser-x.x.x.tar.gz and extract tarball.
$ gzip -cd ArgsParser-x.x.x.tar.gz | tar xvf -
use ArgsParser-x.x.x/lib/ArgsParser.jar archive.
Option[] options = new Option[] {
// long option argument type short description
new Option("long-option1", "1", Option.REQUIRED_ARGUMENT, "description1"),
new Option("long-option2", "2", Option.OPTIONAL_ARGUMENT, "description2"),
new Option("long-option3", "3", Option.NO_ARGUMENT, "description3"),
};
Args arg = new Args(args, options);
Option[] parsedOptions = arg.getOptions();
for(int i = 0; i < parsedOptions.length; i++){
System.out.println("arg" + i + ": " + parsedOptions[i]);
}
Above program execute result is follow.
$ java Prog --long-option1=value1 --long-otion2=value2 --long-option2 -3 hoge arg1: -1, --long-option1: value1[REQUIRE ARGUMENT] arg2: -2, --long-option2: value2[OPTIONAL_ARGUMENT] arg3: -2, --long-option2: [OPTIONAL_ARGUMENT] arg4: -3, --long-option3: [NO_ARGUMENT]
| Contents |
|---|
| Link |
| Contents |
| Link |