Created
January 18, 2013 22:54
-
-
Save wspeirs/4569404 to your computer and use it in GitHub Desktop.
Methods for creation an Option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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