List of usage examples for org.apache.commons.cli Option setRequired
public void setRequired(boolean required)
From source file:com.medvision360.medrecord.tools.dumpadl.CommandLineReader.java
/** * Constructor./*from w ww.ja v a 2s . c om*/ * <p/> * Creates the commandline options. */ public CommandLineReader() { super(); m_options = new Options(); final Option adlOption = new Option("i", "adl", true, "The ADL file to parse."); adlOption.setRequired(true); adlOption.setArgName("adl-file"); m_options.addOption(adlOption); }
From source file:com.opengamma.integration.tool.marketdata.manipulator.dsl.SaveScenario.java
@Override protected Options createOptions(boolean mandatoryConfigResource) { Options options = super.createOptions(mandatoryConfigResource); Option scriptLocation = new Option("s", SCRIPT_LOCATION, true, "Location of the scenario script on the filesystem"); scriptLocation.setRequired(true); options.addOption(scriptLocation);// w w w. j ava2 s .c om Option scenarioId = new Option("i", SCENARIO_ID, true, "Object ID of the scenario definition. Omit to save as " + "a new definition"); options.addOption(scenarioId); return options; }
From source file:com.opengamma.integration.tool.portfolio.PortfolioInfoTool.java
protected Options createOptions(boolean contextProvided) { Options options = super.createOptions(contextProvided); Option origNameOption = new Option(PORTFOLIO_NAME, "origname", true, "The name of the OpenGamma portfolio to copy or rename"); origNameOption.setRequired(true); options.addOption(origNameOption);/*from w ww.ja v a 2 s . c o m*/ return options; }
From source file:com.alibaba.rocketmq.tools.command.topic.DeleteTopicSubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("t", "topic", true, "topic name"); opt.setRequired(true); options.addOption(opt);/*from www .jav a 2 s.com*/ opt = new Option("c", "clusterName", true, "delete topic from which cluster"); opt.setRequired(true); options.addOption(opt); return options; }
From source file:com.alibaba.rocketmq.tools.command.connection.ProducerConnectionSubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("g", "producerGroup", true, "producer group name"); opt.setRequired(true); options.addOption(opt);/*from w w w. j a v a 2 s . co m*/ // topic opt = new Option("t", "topic", true, "topic name"); opt.setRequired(true); options.addOption(opt); return options; }
From source file:com.alibaba.rocketmq.tools.command.broker.SendMsgStatusCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("b", "brokerName", true, "Broker Name"); opt.setRequired(true); options.addOption(opt);/*ww w. j a va2s .c om*/ opt = new Option("s", "messageSize", true, "Message Size, Default: 128"); opt.setRequired(false); options.addOption(opt); opt = new Option("c", "count", true, "send message count, Default: 50"); opt.setRequired(false); options.addOption(opt); return options; }
From source file:com.alibaba.rocketmq.tools.command.consumer.ConsumerSubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("g", "consumerGroup", true, "consumer group name"); opt.setRequired(true); options.addOption(opt);/* w w w. j ava 2s. c om*/ opt = new Option("s", "jstack", false, "Run jstack command in the consumer progress"); opt.setRequired(false); options.addOption(opt); return options; }
From source file:com.alibaba.rocketmq.tools.command.topic.UpdateOrderConfCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("t", "topic", true, "topic name"); opt.setRequired(true); options.addOption(opt);//from w w w .j a v a 2 s. c o m opt = new Option("v", "orderConf", true, "set order conf [eg. brokerName1:num;brokerName2:num]"); opt.setRequired(false); options.addOption(opt); opt = new Option("m", "method", true, "option type [eg. put|get|delete"); opt.setRequired(true); options.addOption(opt); return options; }
From source file:com.genentech.struchk.oeStruchk.OEStruchk.java
/** * Command line interface to {@link OEStruchk}. */// w w w . j a va 2 s . c o m public static void main2(String[] args) throws ParseException { long start = System.currentTimeMillis(); int nMessages = 0; int nErrors = 0; int nStruct = 0; // create command line Options object Options options = new Options(); Option opt = new Option("f", true, "specify the configuration file name"); opt.setRequired(true); options.addOption(opt); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); args = cmd.getArgs(); if (args.length < 1) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("oeStruck", options); throw new Error("missing input file\n"); } String confFile = cmd.getOptionValue("f"); try { oemolistream ifs = new oemolistream(args[0]); oemolostream ofs = new oemolostream(args[1]); // create OEStruchk from config file OEStruchk strchk = new OEStruchk(new File(confFile).toURI().toURL(), CHECKConfig.TESTAssignStuctFlag, false); OEGraphMol mol = new OEGraphMol(); while (oechem.OEReadMolecule(ifs, mol)) { if (!strchk.applyRules(mol, null)) nErrors++; OEGraphMol outMol = strchk.getTransformedMol(null); List<Message> msgs = strchk.getStructureMessages(null); if (msgs.size() > 0) { nMessages += msgs.size(); StringBuilder sb = new StringBuilder(); for (Message msg : msgs) sb.append(String.format("%s: %s\n", msg.getLevel(), msg.getText())); oechem.OESetSDData(outMol, "errors_oe2", sb.toString()); } oechem.OESetSDData(outMol, "ISM", strchk.getTransformedIsoSmiles(null)); oechem.OESetSDData(outMol, "SMI", strchk.getTransformedSmiles(null)); oechem.OEWriteMolecule(ofs, outMol); msgs.clear(); } ofs.close(); ofs.delete(); ifs.close(); ifs.delete(); } catch (Exception e) { throw new Error(e); } finally { System.err.printf("Checked %d structures %d errors, %d messages in %dsec\n", nStruct, nErrors, nMessages, (System.currentTimeMillis() - start) / 1000); } }
From source file:com.netscape.cmstools.system.TPSConnectorShowCLI.java
public void createOptions() { Option option = new Option(null, "host", true, "TPS host"); option.setArgName("host"); option.setRequired(true); options.addOption(option);/*from ww w. j a v a2 s . com*/ option = new Option(null, "port", true, "TPS port"); option.setArgName("port"); options.addOption(option); }