Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Methods for creation an Option
Options options = new Options();
// create the simple option without using the OptionBuilder
options.addOption("o", "opt", false, "An option, no args");
// simple help option using the builder
options.addOption(OptionBuilder.withLongOpt("help")
.create("h"));
// an option with a value separator, defaults to =
options.addOption(OptionBuilder.withValueSeparator()
.withDescription("Java style property")
.create("D"));
// an option with an argument, no short version, and is required
options.addOption(OptionBuilder.withLongOpt("file")
.withArgName("input-file") // also need hasArg() or won't work
.hasArg()
.withDescription("The input file")
.create());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.