List of usage examples for org.apache.commons.cli OptionGroup addOption
public OptionGroup addOption(Option option)
Option
to this group. From source file:edu.cmu.tetrad.cli.CausalCmdApplication.java
private static void populateMainOptions() { OptionGroup optGrp = new OptionGroup(); optGrp.addOption(new Option(null, ALGO_OPT, true, algorithmCmd())); optGrp.addOption(new Option(null, SIM_DATA_OPT, true, simulationCmd())); optGrp.setRequired(true);// w w w . j a v a 2s .c o m MAIN_OPTIONS.addOptionGroup(optGrp); MAIN_OPTIONS.addOption(null, VERSION_OPT, false, "Version."); }
From source file:cz.muni.fi.crocs.EduHoc.OptionsMain.java
public static Options createOptions() { Option help = new Option("h", "help", false, "show help and exit"); Option motes = new Option("a", "motes", true, "path to alternative file of motes, default setting is stored in confix/motePaths.txt"); Option ids = new Option("i", "id", true, "select IDs of nodes from motelist, use comma separated list of IDs or ID ranges, such as 1,3,5-7,9-15"); Option detect = new Option("d", "detect", false, "Perform node detection only"); Option verbose = new Option("v", "verbose", false, "show extended text output"); Option silent = new Option("s", "silent", false, "show limited text output"); OptionGroup output = new OptionGroup(); output.addOption(verbose); output.addOption(silent);//from w ww . jav a 2 s . c om Option make = new Option("m", "make", true, "make target at this path, directory must contain Makefile"); Option makeClean = new Option("c", "make_clean", true, "make clean target at this path, directory must contain Makefile"); Option makeUpload = new Option("u", "make_upload", true, "make target at this path and upload to nodes, directory must contain Makefile"); Option threads = new Option("t", "threads", false, "use threads for paralell upload"); OptionGroup makeGroup = new OptionGroup(); makeGroup.addOption(make); makeGroup.addOption(makeUpload); makeGroup.addOption(makeClean); Option listen = new Option("l", "listen", true, "connect to serial and save stream to files, set path to directory for files"); Option write = new Option("w", "write", true, "write to serial now or after upload, directory must contain at least one file with same name as node"); Option execute = new Option("E", "execute", true, "path to shell script to be executed in phase 3"); Option time = new Option("T", "time", true, "countdown in minutes for serial phase, default is 15 minutes, after this time, serial connection closes"); time.setType(int.class); Options options = new Options(); options.addOption(help); options.addOption(motes); options.addOption(ids); options.addOption(detect); options.addOptionGroup(output); options.addOptionGroup(makeGroup); options.addOption(threads); options.addOption(write); options.addOption(listen); options.addOption(execute); options.addOption(time); return options; }
From source file:com.somerledsolutions.pa11y.client.cli.OptionsBuilder.java
public static Options buildPa11yOptions() { Options options = new Options(); OptionGroup mutuallyExclusiveOptions = new OptionGroup(); mutuallyExclusiveOptions.addOption(getCreateTaskOption()); mutuallyExclusiveOptions.addOption(getListTasksOption()); mutuallyExclusiveOptions.addOption(getRunOption()); mutuallyExclusiveOptions.addOption(getRetrieveTaskOption()); mutuallyExclusiveOptions.addOption(getDeleteTaskOption()); options.addOptionGroup(mutuallyExclusiveOptions); options.addOption(getNameOption());/* w ww . j ava 2 s . c o m*/ options.addOption(getUrlOption()); options.addOption(getStandardOption()); options.addOption(getLastResultOption()); options.addOption(getTaskIdOption()); return options; }
From source file:com.dsf.dbxtract.cdc.App.java
/** * Prepare command line options for CLI. * /*from ww w. j a va 2 s . co m*/ * @return command line options object */ private static Options prepareCmdLineOptions() { Options options = new Options(); // required: --config <file> options.addOption(Option.builder().longOpt(PARAM_CONFIG).hasArg().numberOfArgs(1).argName("file") .desc("configuration file pathname").required().build()); // commands: OptionGroup commands = new OptionGroup(); // --list commands.addOption(Option.builder().longOpt("list").hasArg(false) .desc("list configuration parameters and values").required(false).build()); // --start commands.addOption(Option.builder().longOpt("start").hasArg(false).desc("start dbxtract agent") .required(false).build()); options.addOptionGroup(commands); return options; }
From source file:com.momab.dstool.DSTool.java
static Options commandLineOptions() { Option help = new Option("h", "help", false, "print this message"); Option username = new Option("u", "username", true, "Username to use when sending requests to the remote app"); Option password = new Option("p", "password", true, "Password to use when sending requests to the remote app"); Option port = new Option("P", "port", true, "Network port used when connecting to the app, if omitted the default port 80 wil be used"); Option read = new Option("r", "read", false, "download all entites of the specified kind from the" + "remote app datastore"); Option write = new Option("w", "write", false, "upload entites of the specified kind to the remote" + " app datastore"); Option delete = new Option("d", "delete", false, "delete all entities of the specified kind from the remote" + " app datastore"); Option file = new Option("f", "file", true, "specify a file name to read/write local entity data from/to" + ", stdin/stdout will be used of the filename is omitted"); OptionGroup operations = new OptionGroup(); operations.addOption(read); operations.addOption(write);//from w w w . j a va 2 s . c om operations.addOption(delete); Options options = new Options(); options.addOptionGroup(operations); options.addOption(file); options.addOption(help); options.addOption(username); options.addOption(password); options.addOption(port); return options; }
From source file:com.gmarciani.gmparser.controllers.UiManager.java
/** * <p>Builds available command-line options.<p> * /*from www . j av a2s .c o m*/ * @return command-line options */ @SuppressWarnings("static-access") public static Options buildCommandLineOptions() { Option analyze = OptionBuilder.withLongOpt("analyze").withDescription(AppOptions.DESCRIPTION_ANALYZE) .hasArgs(1).withValueSeparator(' ').withArgName("GRAMMAR").create("a"); Option transform = OptionBuilder.withLongOpt("transform").withDescription(AppOptions.DESCRIPTION_TRANSFORM) .hasArgs(2).withValueSeparator(' ').withArgName("GRAMMAR TRANSFORMATION").create("t"); Option parse = OptionBuilder.withLongOpt("parse").withDescription(AppOptions.DESCRIPTION_PARSE).hasArgs(3) .withValueSeparator(' ').withArgName("GRAMMAR WORD PARSER").create("p"); Option help = OptionBuilder.withLongOpt("help").withDescription(AppOptions.DESCRIPTION_HELP).hasArg(false) .create("h"); Option version = OptionBuilder.withLongOpt("version").withDescription(AppOptions.DESCRIPTION_VERSION) .hasArg(false).create("v"); OptionGroup optionGroup = new OptionGroup(); optionGroup.addOption(analyze); optionGroup.addOption(transform); optionGroup.addOption(parse); optionGroup.addOption(help); optionGroup.addOption(version); Options options = new Options(); options.addOptionGroup(optionGroup); return options; }
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();/* ww w .j a v a 2 s. c o m*/ 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:de.moritzrupp.stockreader.Main.java
/** * initOptions//from www .ja v a 2s .co m * <p>Initializes the options for the console application</p> */ @SuppressWarnings("static-access") private static void initOptions() { Option help = new Option("h", "help", false, "prints the help message"); Option version = new Option("v", "version", false, "prints version and license information and exists"); Option price = new Option("p", "price", false, "prints only the symbol, the date and the price of the stock"); Option csv = OptionBuilder.withArgName("FILE").withLongOpt("file") .withDescription("the path and file name to the exported file").hasArg().create("f"); Option host = OptionBuilder.withArgName("HOST").withLongOpt("host") .withDescription("the SMTP host for sending mails").hasArg().withValueSeparator('=').isRequired() .create(); Option password = OptionBuilder.withArgName("PASS").withLongOpt("password") .withDescription("the password of the mail user").hasArg().withValueSeparator('=').isRequired() .create(); Option user = OptionBuilder.withArgName("USERNAME").withLongOpt("user").withDescription("the mail user") .hasArg().withValueSeparator('=').isRequired().create(); Option from = OptionBuilder.withArgName("FROM").withLongOpt("from").withDescription("the FROM address") .hasArg().withValueSeparator('=').isRequired().create(); Option to = OptionBuilder.withArgName("TO").withLongOpt("to").withDescription("the TO address").hasArg() .withValueSeparator('=').isRequired().create(); OptionGroup mailGroup = new OptionGroup(); mailGroup.addOption(host); mailGroup.addOption(user); mailGroup.addOption(password); mailGroup.addOption(from); mailGroup.addOption(to); mailGroup.setRequired(true); options = new Options(); options.addOption(help); options.addOption(version); options.addOption(price); options.addOption(csv); options.addOptionGroup(mailGroup); formatter = new HelpFormatter(); header = "Pass the stock symbols as arguments and seperate them by spaces. At least one stock symbol is required.\n" + "Example: stockreader DBK.DE SAP.DE\n\n"; footer = "\nFor more information see http://www.moritzrupp.de."; }
From source file:com.falcon.orca.helpers.CommandHelper.java
public static Options createOptions() { Option start = Option.builder("s").longOpt("start").build(); Option stop = Option.builder("st").longOpt("stop").build(); Option pause = Option.builder("p").longOpt("pause").build(); Option continueOpt = Option.builder("re").longOpt("resume").build(); Option exit = Option.builder("e").longOpt("exit").build(); Option url = Option.builder("U").longOpt("url").hasArg(true).build(); Option durationMode = Option.builder("DM").longOpt("durationMode").hasArg(true).build(); Option duration = Option.builder("DU").longOpt("duration").hasArg(true).build(); Option repeats = Option.builder("R").longOpt("repeats").hasArg(true).build(); Option method = Option.builder("M").longOpt("method").hasArg(true).build(); Option header = Option.builder("H").longOpt("header").hasArg(true).build(); Option concurrency = Option.builder("C").longOpt("concurrency").hasArg(true).build(); Option templateFile = Option.builder("TF").longOpt("template").hasArg(true).build(); Option dataFile = Option.builder("DF").longOpt("dataFile").hasArg(true).build(); Option cookies = Option.builder("CO").longOpt("cookie").hasArg(true).build(); Option data = Option.builder("D").longOpt("data").hasArg(true).type(String.class).build(); OptionGroup optionGroup = new OptionGroup(); optionGroup.setRequired(true);//w w w . java 2s . c om optionGroup.addOption(start); optionGroup.addOption(stop); optionGroup.addOption(pause); optionGroup.addOption(continueOpt); optionGroup.addOption(exit); Options options = new Options(); options.addOptionGroup(optionGroup); options.addOption(url); options.addOption(durationMode); options.addOption(duration); options.addOption(repeats); options.addOption(method); options.addOption(header); options.addOption(concurrency); options.addOption(cookies); options.addOption(data); options.addOption(templateFile); options.addOption(dataFile); return options; }
From source file:com.falcon.orca.helpers.CommandHelper.java
public static Options createMasterOptions() { Option start = Option.builder("s").longOpt("start").build(); Option stop = Option.builder("st").longOpt("stop").build(); Option pause = Option.builder("p").longOpt("pause").build(); Option continueOpt = Option.builder("re").longOpt("resume").build(); Option exit = Option.builder("e").longOpt("exit").build(); Option clusterDetails = Option.builder("cd").longOpt("clusterDetails").build(); Option url = Option.builder("U").longOpt("url").hasArg(true).build(); Option durationMode = Option.builder("DM").longOpt("durationMode").hasArg(true).build(); Option duration = Option.builder("DU").longOpt("duration").hasArg(true).build(); Option repeats = Option.builder("R").longOpt("repeats").hasArg(true).build(); Option method = Option.builder("M").longOpt("method").hasArg(true).build(); Option header = Option.builder("H").longOpt("header").hasArg(true).build(); Option concurrency = Option.builder("C").longOpt("concurrency").hasArg(true).build(); Option templateFile = Option.builder("TF").longOpt("template").hasArg(true).build(); Option dataFile = Option.builder("DF").longOpt("dataFile").hasArg(true).build(); Option cookies = Option.builder("CO").longOpt("cookie").hasArg(true).build(); Option data = Option.builder("D").longOpt("data").hasArg(true).type(String.class).build(); OptionGroup optionGroup = new OptionGroup(); optionGroup.setRequired(true);// w w w.j a v a 2 s .c o m optionGroup.addOption(start); optionGroup.addOption(stop); optionGroup.addOption(pause); optionGroup.addOption(continueOpt); optionGroup.addOption(clusterDetails); optionGroup.addOption(exit); Options options = new Options(); options.addOptionGroup(optionGroup); options.addOption(url); options.addOption(durationMode); options.addOption(duration); options.addOption(repeats); options.addOption(method); options.addOption(header); options.addOption(concurrency); options.addOption(cookies); options.addOption(data); options.addOption(templateFile); options.addOption(dataFile); return options; }