List of usage examples for org.apache.commons.cli Option setRequired
public void setRequired(boolean required)
From source file:com.zimbra.cs.mailbox.calendar.FixCalendarTZUtil.java
@Override protected void setupCommandLineOptions() { super.setupCommandLineOptions(); Options options = getOptions();/*from w w w. ja va 2 s . c om*/ Option rulefileOpt = new Option(null, O_RULEFILE, true, "xml file containing fixup rules"); rulefileOpt.setRequired(true); options.addOption(rulefileOpt); Option accountOpt = new Option(O_ACCOUNT, "account", true, "account email addresses seperated by white space or \"all\" for all accounts"); accountOpt.setRequired(true); accountOpt.setArgs(Option.UNLIMITED_VALUES); options.addOption(accountOpt); options.addOption(new Option(null, O_AFTER, true, "fixup calendar items after this time; defaults to beginning of 2007")); options.addOption(new Option(null, O_SYNC, false, "run synchronously; default is asynchronous")); options.addOption(SoapCLI.OPT_AUTHTOKEN); options.addOption(SoapCLI.OPT_AUTHTOKENFILE); }
From source file:com.opengamma.integration.tool.portfolio.PortfolioCopyMoveTool.java
protected Options createOptions(boolean contextProvided) { Options options = super.createOptions(contextProvided); Option origNameOption = new Option(ORIGINAL_PORTFOLIO_NAME, "origname", true, "The name of the OpenGamma portfolio to copy or rename"); origNameOption.setRequired(true); options.addOption(origNameOption);//from w w w.j av a 2 s.c o m Option newNameOption = new Option(NEW_PORTFOLIO_NAME, "newname", true, "The new name of the OpenGamma portfolio"); newNameOption.setRequired(true); options.addOption(newNameOption); Option copyOption = new Option(COPY_OPT, "duplicate", false, "If specified, copy the portfolio instead of moving it (but share referenced positions and securities)"); copyOption.setRequired(false); options.addOption(copyOption); return options; }
From source file:com.twitter.heron.integration_test.common.AbstractTestTopology.java
protected Options getArgOptions() { Options options = new Options(); Option topologyNameOption = new Option("t", TOPOLOGY_OPTION, true, "topology name"); topologyNameOption.setRequired(true); options.addOption(topologyNameOption); Option resultsUrlOption = new Option("r", RESULTS_URL_OPTION, true, "url to post and get test data"); resultsUrlOption.setRequired(true);//from ww w . j a v a 2 s .c om options.addOption(resultsUrlOption); Option stateUrlOption = new Option("s", STATE_URL_OPTION, true, "url to post and get test state info"); stateUrlOption.setRequired(true); options.addOption(stateUrlOption); Option stateTokenOption = new Option("u", STATE_UPDATE_TOKEN, true, "state server token to use for multi-phase test"); stateTokenOption.setRequired(false); options.addOption(stateTokenOption); return options; }
From source file:com.alibaba.rocketmq.tools.command.topic.UpdateTopicPermSubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("b", "brokerAddr", true, "create topic to which broker"); opt.setRequired(false); options.addOption(opt);/*from w w w . j a va2 s.c om*/ opt = new Option("c", "clusterName", true, "create topic to which cluster"); opt.setRequired(false); options.addOption(opt); opt = new Option("t", "topic", true, "topic name"); opt.setRequired(true); options.addOption(opt); opt = new Option("p", "perm", true, "set topic's permission(2|4|6), intro[2:R; 4:W; 6:RW]"); opt.setRequired(true); options.addOption(opt); return options; }
From source file:com.alibaba.rocketmq.tools.command.topic.TopicListSubCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("c", "clusterModel", false, "clusterModel"); opt.setRequired(false); options.addOption(opt);//from w ww. j a v a 2s. c om return options; }
From source file:com.alibaba.rocketmq.tools.command.consumer.DeleteSubscriptionGroupCommand.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("b", "brokerAddr", true, "delete subscription group from which broker"); opt.setRequired(false); options.addOption(opt);/*from w ww. jav a 2 s . c o m*/ opt = new Option("c", "clusterName", true, "delete subscription group from which cluster"); opt.setRequired(false); options.addOption(opt); opt = new Option("g", "groupName", true, "subscription group name"); opt.setRequired(true); options.addOption(opt); return options; }
From source file:com.spectralogic.ds3cli.command.CliCommand.java
/** * Add each Option in a list as a required argument * @param reqArgs List<Option> of required args * @param args Arguments object/* ww w . jav a2 s .c om*/ */ void addRequiredArguments(final List<Option> reqArgs, final Arguments args) { for (final Option oReq : reqArgs) { oReq.setRequired(true); args.addOption(oReq, oReq.getArgName()); } }
From source file:com.spectralogic.ds3cli.command.CliCommand.java
/** * Add each Option in a list as an optional argument * @param reqArgs List<Option> of optional args * @param args Arguments object//from ww w.j av a2 s. c om */ private void addOptionalArguments(final List<Option> reqArgs, final Arguments args) { for (final Option oOpt : reqArgs) { oOpt.setRequired(false); args.addOption(oOpt, oOpt.getArgName()); } }
From source file:de.mat.utils.pdftools.PdfResize.java
@Override protected Options genAvailiableCmdLineOptions() throws Throwable { Options availiableCmdLineOptions = new Options(); // Hilfe-Option Option helpOption = new Option("h", "help", false, "usage"); helpOption.setRequired(false); availiableCmdLineOptions.addOption(helpOption); Option inFile = new Option("i", "in", true, "Input-File"); inFile.setRequired(true);/*ww w .j av a 2 s . c o m*/ availiableCmdLineOptions.addOption(inFile); Option outFile = new Option("o", "out", true, "Outputfile"); outFile.setRequired(true); availiableCmdLineOptions.addOption(outFile); Option factorX = new Option("x", "scalex", true, "Scalierung-X"); factorX.setRequired(true); availiableCmdLineOptions.addOption(factorX); Option factorY = new Option("y", "scaley", true, "Scalierung-Y"); factorY.setRequired(true); availiableCmdLineOptions.addOption(factorY); Option offsetL = new Option("l", "offsetleft", true, "Offset-Left"); offsetL.setRequired(true); availiableCmdLineOptions.addOption(offsetL); Option offsetT = new Option("t", "offsettop", true, "Offset-Top"); offsetT.setRequired(true); availiableCmdLineOptions.addOption(offsetT); return availiableCmdLineOptions; }
From source file:com.alibaba.rocketmq.tools.command.broker.BrokerConsumeStatsSubCommad.java
@Override public Options buildCommandlineOptions(Options options) { Option opt = new Option("b", "brokerAddr", true, "Broker address"); opt.setRequired(true); options.addOption(opt);/*from www .ja va 2 s . c om*/ opt = new Option("t", "timeoutMillis", true, "request timeout Millis"); opt.setRequired(false); options.addOption(opt); opt = new Option("l", "level", true, "threshold of print diff"); opt.setRequired(false); options.addOption(opt); opt = new Option("o", "order", true, "order topic"); opt.setRequired(false); options.addOption(opt); return options; }