The args4j package does not natively handle --foo=value and instead prefers to see --foo value on the command line. Many users are used to the GNU style --foo=value long option, so we convert from the GNU style format to the args4j style format prior to invoking args4j for parsing.
The args4j package does not natively handle --foo=value and instead prefers to see --foo value on the command line. Many users are used to the GNU style --foo=value long option, so we convert from the GNU style format to the args4j style format prior to invoking args4j for parsing.
The args4j package does not natively handle --foo=value and instead prefers to see --foo value on the command line. Many users are used to the GNU style --foo=value long option, so we convert from the GNU style format to the args4j style format prior to invoking args4j for parsing.
class Example { class Options { \@Option(name="t", param="integer", type=Option.OptionType.REQUIRED_ARGUMENT, usage= "a long description here ...") public int threshold = 500; \@option(name="f", param="filename", type=Option.OptionType.REQUIRED_ARGUMENT, usage= "a long description here ...") public String file = "std_file.txt"; \@option(name="fs", param="filename-list comma separated", type=Option.OptionType.REQUIRED_ARGUMENT, usage= "a long description here ...") public VectorTODO Although some support is in place, methods are still not supported. TODO Help-output should be nicely formatted. TODO Make the program description also an annotated type ? @author RA Scheltema @version 1.0.0files = new Vector (); \@option(name="d", param="", type=Option.OptionType.NO_ARGUMENT, usage= "a long description here ...") public boolean do_something = false; } public static void main(String args[]) { Example m = new Example(); Options options = m.new Options(); CmdLineParser parser = new CmdLineParser(options); try { parser.parse(args); } catch(CmdLineException e) { parser.printUsage(System.err, e.toString()); } if (options.do_something) { ... } } }
|
|
|
|
|
|
|
|
|
|
|
|