List of usage examples for org.apache.commons.cli Option setRequired
public void setRequired(boolean required)
From source file:com.linkedin.helix.mock.relay.DummyRelayProcess.java
@SuppressWarnings("static-access") private static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info") .create();//w w w . java2 s. c om Option zkServerOption = OptionBuilder.withLongOpt(zkServer).withDescription("Provide zookeeper address") .create(); zkServerOption.setArgs(1); zkServerOption.setRequired(true); zkServerOption.setArgName("ZookeeperServerAddress(Required)"); Option clusterOption = OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create(); clusterOption.setArgs(1); clusterOption.setRequired(true); clusterOption.setArgName("Cluster name (Required)"); Option hostOption = OptionBuilder.withLongOpt(hostAddress).withDescription("Provide host name").create(); hostOption.setArgs(1); hostOption.setRequired(true); hostOption.setArgName("Host name (Required)"); Option portOption = OptionBuilder.withLongOpt(hostPort).withDescription("Provide host port").create(); portOption.setArgs(1); portOption.setRequired(true); portOption.setArgName("Host port (Required)"); // add an option group including either --zkSvr or --configFile Option fileOption = OptionBuilder.withLongOpt(configFile) .withDescription("Provide file to read states/messages").create(); fileOption.setArgs(1); fileOption.setRequired(true); fileOption.setArgName("File to read states/messages (Optional)"); OptionGroup optionGroup = new OptionGroup(); optionGroup.addOption(zkServerOption); optionGroup.addOption(fileOption); Options options = new Options(); options.addOption(helpOption); // options.addOption(zkServerOption); options.addOption(clusterOption); options.addOption(hostOption); options.addOption(portOption); options.addOptionGroup(optionGroup); return options; }
From source file:com.linkedin.helix.controller.HelixControllerMain.java
@SuppressWarnings("static-access") synchronized private static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(help).withDescription("Prints command-line options info") .create();// ww w . j ava 2s. c o m Option zkServerOption = OptionBuilder.withLongOpt(zkServerAddress) .withDescription("Provide zookeeper address").create(); zkServerOption.setArgs(1); zkServerOption.setRequired(true); zkServerOption.setArgName("ZookeeperServerAddress(Required)"); Option clusterOption = OptionBuilder.withLongOpt(cluster).withDescription("Provide cluster name").create(); clusterOption.setArgs(1); clusterOption.setRequired(true); clusterOption.setArgName("Cluster name (Required)"); Option modeOption = OptionBuilder.withLongOpt(mode) .withDescription("Provide cluster controller mode (Optional): STANDALONE (default) or DISTRIBUTED") .create(); modeOption.setArgs(1); modeOption.setRequired(false); modeOption.setArgName("Cluster controller mode (Optional)"); Option controllerNameOption = OptionBuilder.withLongOpt(name) .withDescription("Provide cluster controller name (Optional)").create(); controllerNameOption.setArgs(1); controllerNameOption.setRequired(false); controllerNameOption.setArgName("Cluster controller name (Optional)"); Option portOption = OptionBuilder.withLongOpt(propertyTransferServicePort) .withDescription("Webservice port for ZkProperty controller transfer").create(); portOption.setArgs(1); portOption.setRequired(false); portOption.setArgName("Cluster controller property transfer port (Optional)"); Options options = new Options(); options.addOption(helpOption); options.addOption(zkServerOption); options.addOption(clusterOption); options.addOption(modeOption); options.addOption(portOption); options.addOption(controllerNameOption); return options; }
From source file:com.linkedin.helix.MockEspressoService.java
@SuppressWarnings("static-access") private static Options constructCommandLineOptions() { Option helpOption = OptionBuilder.withLongOpt(HELP).withDescription("Prints command-line options info") .create();// www . j a v a 2 s . c o m helpOption.setArgs(0); helpOption.setRequired(false); helpOption.setArgName("print help message"); Option zkServerOption = OptionBuilder.withLongOpt(ZKSERVERADDRESS) .withDescription("Provide zookeeper address").create(); zkServerOption.setArgs(1); zkServerOption.setRequired(true); zkServerOption.setArgName("ZookeeperServerAddress(Required)"); Option clusterOption = OptionBuilder.withLongOpt(CLUSTERNAME).withDescription("Provide cluster name") .create(); clusterOption.setArgs(1); clusterOption.setRequired(true); clusterOption.setArgName("Cluster name(Required)"); Option instanceOption = OptionBuilder.withLongOpt(INSTANCENAME) .withDescription("Provide name for this instance").create(); instanceOption.setArgs(1); instanceOption.setRequired(false); instanceOption.setArgName("Instance name(Optional, defaults to localhost)"); Option portOption = OptionBuilder.withLongOpt(PORT).withDescription("Provide web service port").create(); portOption.setArgs(1); portOption.setRequired(false); portOption.setArgName("web service port, default: " + DEFAULT_PORT); Options options = new Options(); options.addOption(helpOption); options.addOption(zkServerOption); options.addOption(clusterOption); options.addOption(instanceOption); options.addOption(portOption); return options; }
From source file:net.sourceforge.dita4publishers.tools.ditadxpunpacker.DitaDxpUnpacker.java
/** * @return/*from www . j a v a2s. com*/ */ private static Options configureOptions() { Options options = configureOptionsBase(); options.getOption(INPUT_OPTION_ONE_CHAR).setDescription("(Package file) DXP file to unpack."); options.getOption(INPUT_OPTION_ONE_CHAR).setLongOpt("dxpfile"); options.getOption(OUTPUT_OPTION_ONE_CHAR) .setDescription("(Output dir) Directory the DXP package is unpacked into."); Option opt = null; options.addOption(UNPACK_ALL_OPTION_ONE_CHAR, "unpackAll", false, "(Unpack all resources) When specified, indicates that all resources in the package should be unpacked."); opt = options.getOption(UNPACK_ALL_OPTION_ONE_CHAR); opt.setRequired(false); options.addOption(MAPS_ID_OPTION_ONE_CHAR, "mapids", true, "(Map IDs) Specifies the IDs (as defined in the DXP package manifest, of the maps to extract."); opt = options.getOption(MAPS_ID_OPTION_ONE_CHAR); opt.setRequired(false); opt.setArgs(Option.UNLIMITED_VALUES); return options; }
From source file:com.opengamma.component.tool.AbstractDbTool.java
private static Option createOutputFileOption() { Option option = new Option(OUTPUT_FILE_OPTION, "output", true, "a file to which the SQL should be output"); option.setArgName("file"); option.setRequired(false); return option; }
From source file:net.sourceforge.dita4publishers.tools.common.MapBosProcessorBase.java
protected static Options configureOptionsBase() { Options options = new Options(); Option opt = null; options.addOption(INPUT_OPTION_ONE_CHAR, "map", true, "(Input) The root map from which to calculate the map tree or bounded object set"); opt = options.getOption(INPUT_OPTION_ONE_CHAR); opt.setRequired(true); options.addOption(OUTPUT_OPTION_ONE_CHAR, "out", true, "(Output) The name of the output directory and, optionally, report file to generate. " + "If not specified, output goes to STDOUT."); opt = options.getOption(OUTPUT_OPTION_ONE_CHAR); opt.setRequired(true);//www . j a v a 2s . c om options.addOption(CATALOG_OPTION_ONE_CHAR, "catalog", true, "(Catalog) Path and filename of the XML catalog to use for resolving DTDs (e.g., catalog-dita.xml)"); opt = options.getOption(OUTPUT_OPTION_ONE_CHAR); opt.setRequired(false); options.addOption(DITAVAL_OPTION_ONE_CHAR, "ditaval", true, "(Ditaval) Path and filename of the the Ditaval file to used to determine applicable key definitions and other elements."); opt = options.getOption(DITAVAL_OPTION_ONE_CHAR); opt.setRequired(false); options.addOption(QUIET_OPTION_ONE_CHAR, "quiet", false, "(Quiet) Turns off logging of actions."); opt = options.getOption(QUIET_OPTION_ONE_CHAR); opt.setRequired(false); options.addOption(ADDRESSING_FAILURE_OPTION_ONE_CHAR, "addressfailure", false, "(Fail on addressing failure) When specified, addressing failures cause BOS construction to fail."); opt = options.getOption(ADDRESSING_FAILURE_OPTION_ONE_CHAR); opt.setRequired(false); return options; }
From source file:de.uni_koblenz.jgralab.utilities.tgmerge.TGMerge.java
private static CommandLine processCommandLineOptions(String[] args) { String toolString = "java " + TGMerge.class.getName(); String versionString = JGraLab.getInfo(false); OptionHandler oh = new OptionHandler(toolString, versionString); Option output = new Option("o", "outTG", true, "(required): output TG file"); output.setRequired(true); output.setArgName("outputTG"); oh.addOption(output);/*from w ww. j av a 2 s. c om*/ oh.setArgumentCount(Option.UNLIMITED_VALUES); oh.setArgumentName("inputTG"); oh.setOptionalArgument(false); return oh.parse(args); }
From source file:de.uni_koblenz.jgralab.utilities.greqlinterface.GReQLConsole.java
private static CommandLine processCommandLineOptions(String[] args) { String toolString = "java " + GReQLConsole.class.getName(); String versionString = JGraLab.getInfo(false); OptionHandler oh = new OptionHandler(toolString, versionString); Option queryfile = new Option("q", "queryfile", true, "(required): queryfile which should be executed. May contain " + "many queries separated by //-- on a line"); queryfile.setRequired(true); queryfile.setArgName("file"); oh.addOption(queryfile);//w w w . jav a 2 s . c om Option inputFile = new Option("g", "graph", true, "(optional): the tg-file of the graph"); inputFile.setRequired(false); inputFile.setArgName("file"); oh.addOption(inputFile); Option output = new Option("o", "output", true, "(optional): HTML-file to be generated"); output.setArgName("file"); oh.addOption(output); Option loadschema = new Option("s", "loadschema", false, "(optional): Loads also the schema from the file"); oh.addOption(loadschema); Option verbose = new Option("v", "verbose", false, "(optional): Produce verbose output"); oh.addOption(verbose); return oh.parse(args); }
From source file:at.ac.tuwien.ims.latex2mobiformulaconv.app.Main.java
private static void initializeOptions() { options = new Options(); Option inputOption = new Option("i", "inputPaths", true, "inputPaths file"); inputOption.setRequired(true); inputOption.setArgs(Option.UNLIMITED_VALUES); inputOption.setOptionalArg(false);/* w w w . j a v a 2 s . co m*/ inputOption.setValueSeparator(','); options.addOption(inputOption); options.addOption("f", "filename", true, "output filename"); options.addOption("o", "output-dir", true, "output directory"); options.addOption("m", "export-markup", false, "export html markup"); options.addOption("n", "no-mobi", false, "no Mobi conversion, just markup, NOTE: makes -m implicit!"); options.addOption("t", "title", true, "Document title"); options.addOption("h", "help", false, "show this help"); options.addOption("d", "debugMarkupOutput", false, "show debug output in html markup"); options.addOption("u", "use-calibre", false, "use calibre ebook-convert instead of kindlegen"); Option picturesOption = new Option("r", "replace latex formulas with pictures, override html"); picturesOption.setLongOpt("replace-with-images"); picturesOption.setArgs(0); picturesOption.setRequired(false); options.addOption(picturesOption); // implementation specific options options.addOption( ((LatexToHtmlConverter) applicationContext.getBean("latex2html-converter")).getExecOption()); options.addOption( ((HtmlToMobiConverter) applicationContext.getBean(KINDLEGEN_HTML2MOBI_CONVERTER)).getExecOption()); options.addOption( ((HtmlToMobiConverter) applicationContext.getBean(CALIBRE_HTML2MOBI_CONVERTER)).getExecOption()); }
From source file:com.opengamma.component.tool.AbstractComponentTool.java
private static Option createLogbackOption() { Option option = new Option(LOGBACK_RESOURCE_OPTION, "logback", true, "the logback configuration resource"); option.setArgName("resource"); option.setRequired(false); return option; }