List of usage examples for org.apache.commons.cli OptionBuilder create
public static Option create(String opt) throws IllegalArgumentException
char
. From source file:org.jnotary.client.DvcsCheck.java
@SuppressWarnings("static-access") private static Option createOption(String shortOptionName, String optionName, String description, boolean hasValue, boolean isMandatory) { OptionBuilder opt = OptionBuilder.withLongOpt(optionName).withArgName(shortOptionName) .withDescription(description); if (hasValue) opt = opt.hasArg();//from w ww .jav a 2 s. c o m if (isMandatory) opt = opt.isRequired(); return opt.create(shortOptionName); }
From source file:org.jrman.main.JRMan.java
private static Options prepareOptions() { Options options = new Options(); OptionBuilder.withLongOpt("help"); OptionBuilder.withDescription("show this usage information and exits"); options.addOption(OptionBuilder.create(OPTION_HELP)); OptionBuilder.withLongOpt("version"); OptionBuilder.withDescription("show application version and exits"); options.addOption(OptionBuilder.create(OPTION_VERSION)); OptionBuilder.withLongOpt("display"); OptionBuilder.withDescription("always show image in a framebuffer display (implicitly add such " + "display if not already present)"); options.addOption(OptionBuilder.create(OPTION_FRAMEBUFFER)); OptionBuilder.withLongOpt("progress"); OptionBuilder.withDescription("show per frame rendering progress"); options.addOption(OptionBuilder.create(OPTION_PROGRESS)); OptionBuilder.withLongOpt("first"); OptionBuilder.withDescription("start rendering from <frame>"); OptionBuilder.hasArg();//from www. j ava 2 s .c o m OptionBuilder.withType(new Integer(1)); OptionBuilder.withArgName("frame"); options.addOption(OptionBuilder.create(OPTION_FIRSTFRAME)); OptionBuilder.withLongOpt("end"); OptionBuilder.withDescription("stop rendering after <frame>"); OptionBuilder.hasArg(); OptionBuilder.withArgName("frame"); options.addOption(OptionBuilder.create(OPTION_LASTFRAME)); OptionBuilder.withLongOpt("stats"); OptionBuilder.withDescription("print end of frame statistics"); // TODO implement level of detail for rendering statistics //OptionBuilder.hasOptionalArg(); //OptionBuilder.withType(new Integer(1)); //OptionBuilder.withArgName("level"); options.addOption(OptionBuilder.create(OPTION_STATISTICS)); OptionBuilder.withLongOpt("quality"); OptionBuilder.withDescription("higher rendering quality (slightly slower)"); options.addOption(OptionBuilder.create(OPTION_QUALITY)); return options; }
From source file:org.lib4j.cli.Options.java
public static Options parse(final Cli binding, final Class<?> mainClass, final String[] args) { final Set<String> requiredNames = new HashSet<>(); final Map<String, String> nameToAltName = new HashMap<>(); final org.apache.commons.cli.Options apacheOptions = new org.apache.commons.cli.Options(); apacheOptions.addOption(null, "help", false, "Print help and usage."); short argumentsMinOccurs = 0; short argumentsMaxOccurs = 0; final Cli.Arguments cliArguments; if (binding != null) { cliArguments = binding.getArguments(); if (cliArguments != null) { argumentsMinOccurs = cliArguments.getMinOccurs(); argumentsMaxOccurs = "unbounded".equals(cliArguments.getMaxOccurs()) ? Short.MAX_VALUE : Short.parseShort(cliArguments.getMaxOccurs()); if (argumentsMaxOccurs < argumentsMinOccurs) { logger.error("minOccurs > maxOccurs on <arguments> element"); System.exit(1);//from www . j av a2 s . c om } } if (binding.getOption() != null) { for (final Cli.Option option : binding.getOption()) { final Cli.Option.Name optionName = option.getName(); final String longName = optionName.getLong() == null ? null : optionName.getLong(); final String shortName = optionName.getShort() == null ? null : optionName.getShort(); final String name = longName != null ? longName : shortName; if (longName == null && shortName == null) { logger.error("both [long] and [short] option names are null in cli spec"); System.exit(1); } nameToAltName.put(name, shortName != null ? shortName : longName); OptionBuilder.withLongOpt(name == longName ? longName : null); // Record which options are required if (option.getArgument() != null) { final Cli.Option.Argument argument = option.getArgument(); final boolean isRequired = Use.REQUIRED == argument.getUse(); if (isRequired) { OptionBuilder.isRequired(); requiredNames.add(longName); } final int maxOccurs = argument.getMaxOccurs() == null ? 1 : "unbounded".equals(argument.getMaxOccurs()) ? Integer.MAX_VALUE : Integer.parseInt(argument.getMaxOccurs()); if (maxOccurs == 1) { if (isRequired) OptionBuilder.hasArgs(1); else OptionBuilder.hasOptionalArgs(1); } else if (maxOccurs == Integer.MAX_VALUE) { if (isRequired) OptionBuilder.hasArgs(); else OptionBuilder.hasOptionalArgs(); } else { if (isRequired) OptionBuilder.hasArgs(maxOccurs); else OptionBuilder.hasOptionalArgs(maxOccurs); } final char valueSeparator = argument.getValueSeparator() != null ? argument.getValueSeparator().charAt(0) : ' '; OptionBuilder .withArgName(formatArgumentName(argument.getLabel(), maxOccurs, valueSeparator)); OptionBuilder.withValueSeparator(valueSeparator); if (option.getDescription() == null) { logger.error("missing <description> for " + name + " option"); System.exit(1); } final StringBuilder description = new StringBuilder(option.getDescription()); if (option.getArgument().getDefault() != null) description.append("\nDefault: ").append(option.getArgument().getDefault()); OptionBuilder.withDescription(description.toString()); } apacheOptions.addOption(OptionBuilder.create(shortName)); } } } else { cliArguments = null; } final Map<String, Option> optionsMap = new HashMap<>(); final Set<String> specifiedLongNames; CommandLine commandLine = null; if (args != null && args.length != 0) { specifiedLongNames = new HashSet<>(); final CommandLineParser parser = new PosixParser(); do { try { commandLine = parser.parse(apacheOptions, args); } catch (final UnrecognizedOptionException e) { if (e.getMessage().startsWith("Unrecognized option: ")) { final String unrecognizedOption = e.getMessage().substring(21); logger.error("Unrecognized option: " + unrecognizedOption); for (int i = 0; i < args.length; i++) if (args[i].equals(unrecognizedOption)) args[i] = "--help"; } else { throw new IllegalArgumentException(e); } } catch (final org.apache.commons.cli.ParseException e) { Options.trapPrintHelp(apacheOptions, cliArguments, null, System.err); } } while (commandLine == null); } else { specifiedLongNames = null; } final Collection<String> arguments = commandLine != null ? commandLine.getArgList() : null; if (arguments != null && arguments.size() > 0) { if (argumentsMaxOccurs < arguments.size() || arguments.size() < argumentsMinOccurs) { Options.trapPrintHelp(apacheOptions, cliArguments, null, System.err); } } else if (argumentsMinOccurs > 0) { Options.trapPrintHelp(apacheOptions, cliArguments, null, System.err); } if (commandLine != null) { for (final org.apache.commons.cli.Option option : commandLine.getOptions()) { specifiedLongNames.add(option.getLongOpt()); if ("help".equals(option.getLongOpt())) Options.trapPrintHelp(apacheOptions, cliArguments, null, System.out); final String optionName = option.getLongOpt() != null ? option.getLongOpt() : option.getOpt(); optionsMap.put(optionName, option.getValue() != null ? new Option(optionName, option.getValueSeparator(), option.getValues()) : new Option(optionName, option.getValueSeparator(), "true")); } } // See if some arguments are missing if (requiredNames.size() != 0) { if (specifiedLongNames != null) requiredNames.removeAll(specifiedLongNames); if (requiredNames.size() != 0) { final StringBuilder builder = new StringBuilder(); for (final String longName : requiredNames) { final String shortName = nameToAltName.get(longName); if (shortName.equals(longName)) builder.append("\nMissing argument: -").append(shortName); else builder.append("\nMissing argument: -").append(shortName).append(",--").append(longName); } Options.trapPrintHelp(apacheOptions, cliArguments, builder.substring(1), System.out); } } // Include default values for options that are not specified if (binding.getOption() != null) { for (final Cli.Option option : binding.getOption()) { if (option.getArgument() != null && option.getArgument().getDefault() != null) { final String optionName = option.getName().getLong() != null ? option.getName().getLong() : option.getName().getShort(); if (!optionsMap.containsKey(optionName)) { final String valueSeparator = option.getArgument().getValueSeparator(); final String defaultValue = option.getArgument().getDefault(); optionsMap.put(optionName, valueSeparator != null ? new Option(optionName, valueSeparator.charAt(0), defaultValue) : new Option(optionName, defaultValue)); } } } } // Check pattern for specified and default options if (binding.getOption() != null) { final StringBuilder builder = new StringBuilder(); for (final Cli.Option option : binding.getOption()) { if (option.getArgument() != null && option.getArgument().getPattern() != null) { final String optionName = option.getName().getLong() != null ? option.getName().getLong() : option.getName().getShort(); final Option opt = optionsMap.get(optionName); if (opt != null) { for (final String value : opt.getValues()) { if (!value.matches(option.getArgument().getPattern())) { if (option.getName().getLong() == null || option.getName().getShort() == null) builder.append("\nIncorrect argument form: -").append(optionName); else builder.append("\nIncorrect argument form: -") .append(option.getName().getShort()).append(",--") .append(option.getName().getLong()); builder.append(' ').append(value).append("\n Required: ") .append(option.getArgument().getPattern()); } } } } } if (builder.length() > 0) Options.trapPrintHelp(apacheOptions, cliArguments, builder.substring(1), System.out); } return new Options(mainClass, args, optionsMap.values(), arguments == null || arguments.size() == 0 ? null : arguments.toArray(new String[arguments.size()])); }
From source file:org.libx4j.cli.Options.java
public static Options parse(final cli_cli binding, final Class<?> mainClass, final String[] args) throws OptionsException { final Set<String> requiredNames = new HashSet<String>(); final Map<String, String> nameToAltName = new HashMap<String, String>(); final org.apache.commons.cli.Options apacheOptions = new org.apache.commons.cli.Options(); apacheOptions.addOption(null, "help", false, "Print help and usage."); int argumentsMinOccurs = 0; int argumentsMaxOccurs = 0; final cli_cli._arguments cliArguments; if (binding != null) { cliArguments = binding._arguments(0); if (!cliArguments.isNull()) { argumentsMinOccurs = cliArguments._minOccurs$().text(); argumentsMaxOccurs = "unbounded".equals(cliArguments._maxOccurs$().text()) ? Integer.MAX_VALUE : Integer.parseInt(cliArguments._maxOccurs$().text()); if (argumentsMaxOccurs < argumentsMinOccurs) { logger.error("minOccurs > maxOccurs on <arguments> element"); System.exit(1);/*from ww w. j a va2 s.c om*/ } } if (binding._option() != null) { for (final cli_cli._option option : binding._option()) { final cli_cli._option._name optionName = option._name(0); final String longName = optionName._long$().isNull() ? null : optionName._long$().text(); final String shortName = optionName._short$().isNull() ? null : optionName._short$().text(); final String name = longName != null ? longName : shortName; if (longName == null && shortName == null) { logger.error("both [long] and [short] option names are null in cli spec"); System.exit(1); } nameToAltName.put(name, shortName != null ? shortName : longName); OptionBuilder.withLongOpt(name == longName ? longName : null); // Record which options are required if (option._argument() != null && option._argument().size() != 0) { final cli_cli._option._argument argument = option._argument(0); final boolean isRequired = $cli_use.required.text().equals(argument._use$().text()); if (isRequired) { OptionBuilder.isRequired(); requiredNames.add(longName); } final int maxOccurs = argument._maxOccurs$().isNull() ? 1 : "unbounded".equals(argument._maxOccurs$().text()) ? Integer.MAX_VALUE : Integer.parseInt(argument._maxOccurs$().text()); if (maxOccurs == 1) { if (isRequired) OptionBuilder.hasArgs(1); else OptionBuilder.hasOptionalArgs(1); } else if (maxOccurs == Integer.MAX_VALUE) { if (isRequired) OptionBuilder.hasArgs(); else OptionBuilder.hasOptionalArgs(); } else { if (isRequired) OptionBuilder.hasArgs(maxOccurs); else OptionBuilder.hasOptionalArgs(maxOccurs); } final char valueSeparator = argument._valueSeparator$().text() != null ? argument._valueSeparator$().text().charAt(0) : ' '; OptionBuilder.withArgName( formatArgumentName(argument._label$().text(), maxOccurs, valueSeparator)); OptionBuilder.withValueSeparator(valueSeparator); if (option._description(0).isNull()) { logger.error("missing <description> for " + name + " option"); System.exit(1); } final StringBuilder description = new StringBuilder(option._description(0).text()); if (!option._argument(0)._default$().isNull()) description.append("\nDefault: ").append(option._argument(0)._default$().text()); OptionBuilder.withDescription(description.toString()); } apacheOptions.addOption(OptionBuilder.create(shortName)); } } } else { cliArguments = null; } final Map<String, Option> optionsMap = new HashMap<String, Option>(); final Set<String> specifiedLongNames; CommandLine commandLine = null; if (args != null && args.length != 0) { specifiedLongNames = new HashSet<String>(); final CommandLineParser parser = new PosixParser(); do { try { commandLine = parser.parse(apacheOptions, args); } catch (final UnrecognizedOptionException e) { if (e.getMessage().startsWith("Unrecognized option: ")) { final String unrecognizedOption = e.getMessage().substring(21); logger.error("Unrecognized option: " + unrecognizedOption); for (int i = 0; i < args.length; i++) if (args[i].equals(unrecognizedOption)) args[i] = "--help"; } else { throw new OptionsException(e); } } catch (final org.apache.commons.cli.ParseException e) { Options.trapPrintHelp(apacheOptions, cliArguments, null, System.err); } } while (commandLine == null); } else { specifiedLongNames = null; } final Collection<String> arguments = commandLine != null ? commandLine.getArgList() : null; if (arguments != null && arguments.size() > 0) { if (argumentsMaxOccurs < arguments.size() || arguments.size() < argumentsMinOccurs) { Options.trapPrintHelp(apacheOptions, cliArguments, null, System.err); } } else if (argumentsMinOccurs > 0) { Options.trapPrintHelp(apacheOptions, cliArguments, null, System.err); } if (commandLine != null) { for (final org.apache.commons.cli.Option option : commandLine.getOptions()) { specifiedLongNames.add(option.getLongOpt()); if ("help".equals(option.getLongOpt())) Options.trapPrintHelp(apacheOptions, cliArguments, null, System.out); final String optionName = option.getLongOpt() != null ? option.getLongOpt() : option.getOpt(); optionsMap.put(optionName, option.getValue() != null ? new Option(optionName, option.getValueSeparator(), option.getValues()) : new Option(optionName, option.getValueSeparator(), "true")); } } // See if some arguments are missing if (requiredNames.size() != 0) { if (specifiedLongNames != null) requiredNames.removeAll(specifiedLongNames); if (requiredNames.size() != 0) { final StringBuilder builder = new StringBuilder(); for (final String longName : requiredNames) { final String shortName = nameToAltName.get(longName); if (shortName.equals(longName)) builder.append("\nMissing argument: -").append(shortName); else builder.append("\nMissing argument: -").append(shortName).append(",--").append(longName); } Options.trapPrintHelp(apacheOptions, cliArguments, builder.substring(1), System.out); } } // Include default values for options that are not specified if (binding._option() != null) { for (final cli_cli._option option : binding._option()) { if (!option._argument(0)._default$().isNull()) { final String optionName = !option._name(0)._long$().isNull() ? option._name(0)._long$().text() : option._name(0)._short$().text(); if (!optionsMap.containsKey(optionName)) { final String valueSeparator = option._argument(0)._valueSeparator$().text(); final String defaultValue = option._argument(0)._default$().text(); optionsMap.put(optionName, valueSeparator != null ? new Option(optionName, valueSeparator.charAt(0), defaultValue) : new Option(optionName, defaultValue)); } } } } // Check pattern for specified and default options if (binding._option() != null) { final StringBuilder builder = new StringBuilder(); for (final cli_cli._option option : binding._option()) { if (!option._argument(0)._pattern$().isNull()) { final String optionName = !option._name(0)._long$().isNull() ? option._name(0)._long$().text() : option._name(0)._short$().text(); final Option opt = optionsMap.get(optionName); if (opt != null) { for (final String value : opt.getValues()) { if (!value.matches(option._argument(0)._pattern$().text())) { if (option._name(0)._long$().isNull() || option._name(0)._short$().isNull()) builder.append("\nIncorrect argument form: -").append(optionName); else builder.append("\nIncorrect argument form: -") .append(option._name(0)._short$().text()).append(",--") .append(option._name(0)._long$().text()); builder.append(" ").append(value).append("\n Required: ") .append(option._argument(0)._pattern$().text()); } } } } } if (builder.length() > 0) Options.trapPrintHelp(apacheOptions, cliArguments, builder.substring(1), System.out); } return new Options(mainClass, args, optionsMap.values(), arguments == null || arguments.size() == 0 ? null : arguments.toArray(new String[arguments.size()])); }
From source file:org.lockss.devtools.PdfTools.java
protected Options initializeOptions() { Options options = new Options(); OptionBuilder.withLongOpt(HELP_LONG); OptionBuilder.withDescription("Displays this help message"); options.addOption(OptionBuilder.create(HELP)); OptionBuilder.withLongOpt(INPUT_LONG); OptionBuilder.withDescription("Input PDF file"); OptionBuilder.hasArg();// ww w . ja va 2 s . c om OptionBuilder.withArgName("infile"); options.addOption(OptionBuilder.create(INPUT)); OptionBuilder.withLongOpt(REWRITE_LONG); OptionBuilder.withDescription("Rewrites infile (normalizes token streams, etc.) to outfile"); OptionBuilder.hasArg(); OptionBuilder.withArgName("outfile"); options.addOption(OptionBuilder.create(REWRITE)); OptionBuilder.withLongOpt(TOKEN_STREAMS_LONG); OptionBuilder.withDescription("Dumps all token streams to outfile"); OptionBuilder.hasArg(); OptionBuilder.withArgName("outfile"); options.addOption(OptionBuilder.create(TOKEN_STREAMS)); return options; }
From source file:org.magdaaproject.analysis.rhizome.RhizomeAnalysis.java
private static Options createOptions() { Options options = new Options(); // task type/* w ww . j a v a2s . c om*/ OptionBuilder.withArgName("string"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("task to undertake"); OptionBuilder.isRequired(true); options.addOption(OptionBuilder.create("task")); // properties file path OptionBuilder.withArgName("path"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("path to the properties file"); OptionBuilder.isRequired(true); options.addOption(OptionBuilder.create("properties")); // table name OptionBuilder.withArgName("string"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("name of table to work with"); OptionBuilder.isRequired(true); options.addOption(OptionBuilder.create("table")); // path to input database OptionBuilder.withArgName("path"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("path to a single input rhizome database"); options.addOption(OptionBuilder.create("input")); // id of the tablet OptionBuilder.withArgName("string"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("id of the tablet"); options.addOption(OptionBuilder.create("tablet")); // parent directory of data to import OptionBuilder.withArgName("path"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("path to the parent directory of a dataset"); options.addOption(OptionBuilder.create("dataset")); // path to output file OptionBuilder.withArgName("path"); OptionBuilder.hasArg(true); OptionBuilder.withDescription("path to an output file"); options.addOption(OptionBuilder.create("output")); return options; }
From source file:org.movsim.input.MovsimCommandLine.java
private void createOptions() { options = new Options(); options.addOption("h", "help", false, "prints this message"); options.addOption("v", "validate", false, "parses xml input file for validation (without simulation)"); options.addOption("w", "write_xsd", false, "writes xsd file to output (for convenience/lookup schema definitions)"); options.addOption("l", "log", false, "writes the file \"log4j.properties\" to file to adjust the logging properties on an individual level"); options.addOption("d", "write_dot", false, "writes a 'dot' network file for further analysis of the xodr"); options.addOption("s", "simulation scanning mode", false, "invokes the simulator repeatedly in a loop (needs to be programmed by user)"); OptionBuilder.withArgName("file"); OptionBuilder.hasArg();// ww w. j a va2 s. c om ProjectMetaData.getInstance(); OptionBuilder.withDescription("movsim main configuration file (ending \"" + ProjectMetaData.getMovsimConfigFileEnding() + "\" will be added automatically if not provided."); final Option xmlSimFile = OptionBuilder.create("f"); options.addOption(xmlSimFile); OptionBuilder.withArgName("directory"); OptionBuilder.hasArg(); OptionBuilder.withDescription("argument is the output path relative to calling directory"); final Option outputPathOption = OptionBuilder.create("o"); options.addOption(outputPathOption); }
From source file:org.neovera.jdiablo.internal.OptionAnnotatedProperty.java
@SuppressWarnings("static-access") public org.apache.commons.cli.Option getCliOption() { if (_cliOption != null) { return _cliOption; } else {//from ww w.ja va2 s . c o m Option option = getOption(); OptionBuilder builder = OptionBuilder.withDescription(option.description()); if (StringUtils.isNotBlank(option.argName())) { builder = builder.withArgName(option.argName()); } if (option.args() != 0) { builder = builder.hasArgs(option.args()); } if (option.hasArgs()) { builder = builder.hasArgs(); } if (StringUtils.isNotBlank(option.longOption())) { builder = builder.withLongOpt(option.longOption()); } if (option.optionalArgs() != 0) { builder = builder.hasOptionalArgs(option.optionalArgs()); } if (option.required() && !getOptionProperty().isOptionNotRequiredOverride()) { builder = builder.isRequired(); } if (option.valueSeparator() != ' ') { builder = builder.withValueSeparator(option.valueSeparator()); } setCliOption(builder.create(option.shortOption())); return getCliOption(); } }
From source file:org.nuxeo.launcher.NuxeoLauncher.java
/** * @since 5.6/*from w ww. j a va2 s . com*/ */ protected static void initParserOptions() { if (launcherOptions == null) { launcherOptions = new Options(); // help option OptionBuilder.withLongOpt(OPTION_HELP); OptionBuilder.withDescription(OPTION_HELP_DESC); launcherOptions.addOption(OptionBuilder.create("h")); // Quiet option OptionBuilder.withLongOpt(OPTION_QUIET); OptionBuilder.withDescription(OPTION_QUIET_DESC); launcherOptions.addOption(OptionBuilder.create("q")); // Debug option OptionBuilder.withLongOpt(OPTION_DEBUG); OptionBuilder.withDescription(OPTION_DEBUG_DESC); launcherOptions.addOption(OptionBuilder.create("d")); // Debug category option OptionBuilder.withDescription(OPTION_DEBUG_CATEGORY_DESC); OptionBuilder.hasArg(); launcherOptions.addOption(OptionBuilder.create(OPTION_DEBUG_CATEGORY)); OptionGroup outputOptions = new OptionGroup(); // Hide deprecation warnings option OptionBuilder.withLongOpt(OPTION_HIDE_DEPRECATION); OptionBuilder.withDescription(OPTION_HIDE_DEPRECATION_DESC); outputOptions.addOption(OptionBuilder.create()); // XML option OptionBuilder.withLongOpt(OPTION_XML); OptionBuilder.withDescription(OPTION_XML_DESC); outputOptions.addOption(OptionBuilder.create()); // JSON option OptionBuilder.withLongOpt(OPTION_JSON); OptionBuilder.withDescription(OPTION_JSON_DESC); outputOptions.addOption(OptionBuilder.create()); launcherOptions.addOptionGroup(outputOptions); // GUI option OptionBuilder.withLongOpt(OPTION_GUI); OptionBuilder.hasArg(); OptionBuilder.withArgName("true|false"); OptionBuilder.withDescription(OPTION_GUI_DESC); launcherOptions.addOption(OptionBuilder.create()); // Package management option OptionBuilder.withLongOpt(OPTION_NODEPS); OptionBuilder.withDescription(OPTION_NODEPS_DESC); launcherOptions.addOption(OptionBuilder.create()); // Relax on target platform option OptionBuilder.withLongOpt(OPTION_RELAX); OptionBuilder.hasArg(); OptionBuilder.withArgName("true|false|ask"); OptionBuilder.withDescription(OPTION_RELAX_DESC); launcherOptions.addOption(OptionBuilder.create()); // Accept option OptionBuilder.withLongOpt(OPTION_ACCEPT); OptionBuilder.hasArg(); OptionBuilder.withArgName("true|false|ask"); OptionBuilder.withDescription(OPTION_ACCEPT_DESC); launcherOptions.addOption(OptionBuilder.create()); } }
From source file:org.openmainframe.ade.ext.main.Analyze.java
/** * Method to parse specific arguments for "Analyze". *//*from www . j ava 2 s . co m*/ @Override protected final void parseArgs(String[] args) throws AdeException { final Options options = new Options(); OptionBuilder.withArgName(OPTION_SOURCES); OptionBuilder.withLongOpt(OPTION_SOURCES); OptionBuilder.isRequired(false); OptionBuilder.hasArg(); OptionBuilder.withDescription("Specify the Source to be analyzed. "); options.addOption(OptionBuilder.create("s")); super.parseArgs(options, args); }