List of usage examples for org.apache.commons.cli Option UNLIMITED_VALUES
int UNLIMITED_VALUES
To view the source code for org.apache.commons.cli Option UNLIMITED_VALUES.
Click Source Link
From source file:LineageSimulator.java
public static void main(String[] args) { Options options = new Options(); // commands//from w w w . ja v a2s .c o m //options.addOption("simulate", false, "Simulate lineage trees"); //options.addOption("sample", false, "Sample from the simulated trees"); //options.addOption("evaluate", false, "Evaluate trees"); // tree simulation options.addOption("t", "nTrees", true, "Number of trees to simulate (default: 100)"); options.addOption("i", "nIter", true, "Number of tree growth iterations (default: 50)"); options.addOption("snv", "probSNV", true, "Per node probablity of generating a descendant cell population with an acquired SNV during a tree growth iteration (default: 0.15)"); options.addOption("cnv", "probCNV", true, "Per node probablity of generating a descendant cell population with an acquired CNV during a tree growth iteration (default: 0.02)"); options.addOption("probDeath", true, "Probablity of a cell population death in each tree growth iteration (default: 0.06)"); options.addOption("maxPopulationSize", true, "Max size of a cell population (default: 1000000)"); options.addOption("minNodes", true, "Minimum number of undead cell population nodes in a valid tree, tree growth will continue beyond the defined number of iterations until this value is reached (default: 10)"); options.addOption("maxNodes", true, "Maximum number of undead cell population nodes in a tree, tree growth will stop after the iteration in which this value is reached/first surpassed (default: 1000)"); // sampling Option samplesOption = new Option("s", "nSamples", true, "Number of samples to collect, accepts multiple values, e.g. 5 10 15 (default: 5)"); samplesOption.setArgs(Option.UNLIMITED_VALUES); options.addOption(samplesOption); Option covOption = new Option("c", "coverage", true, "Simulated coverage to generate the VAFs, accepts multiple values, e.g. 500 1000 (default: 1000)"); covOption.setArgs(Option.UNLIMITED_VALUES); options.addOption(covOption); options.addOption("maxSubclones", true, "Max number of subclones per sample (default: 5)"); options.addOption("sampleSize", true, "Number of cells per sample (default: 100000)"); options.addOption("e", true, "Sequencing error (default: 0.001)"); options.addOption("minNC", true, "Minimum percentage of normal contamination per sample; the percentage will be randomly generated from the range [minNC maxNC] for each sample (default: 0)"); options.addOption("maxNC", true, "Maximum percentage of normal contamination per sample; if maxNC < minNC, maxNC will be automatically set to minNC; the percentage will be randomly generated from the range [minNC maxNC] for each sample (default: 20)"); //options.addOption("localized", false, "Enable localized sampling (default: random sampling)"); //options.addOption("mixSubclone", false, "With localized sampling, add an additional subclone from a different subtree to each sample; by default, the sample is localized to a single disjoint subtree"); // input/output/display options.addOption("dir", "outputDir", true, "Directory where the output files should be created [required]"); options.addOption("dot", false, "Produce DOT files for the simulated trees"); options.addOption("sdot", "sampledDot", false, "Produce DOT files for the simulated trees with indicated samples"); options.addOption("sampleProfile", false, "Output VAF file includes an additional column with the binary sample profile for each SNV"); // other options.addOption("v", "verbose", false, "Verbose mode"); options.addOption("h", "help", false, "Print usage"); // display order ArrayList<Option> optionsList = new ArrayList<Option>(); optionsList.add(options.getOption("dir")); optionsList.add(options.getOption("t")); optionsList.add(options.getOption("i")); optionsList.add(options.getOption("snv")); optionsList.add(options.getOption("cnv")); optionsList.add(options.getOption("probDeath")); optionsList.add(options.getOption("maxPopulationSize")); optionsList.add(options.getOption("minNodes")); optionsList.add(options.getOption("maxNodes")); optionsList.add(options.getOption("s")); optionsList.add(options.getOption("c")); optionsList.add(options.getOption("maxSubclones")); optionsList.add(options.getOption("sampleSize")); optionsList.add(options.getOption("e")); optionsList.add(options.getOption("minNC")); optionsList.add(options.getOption("maxNC")); optionsList.add(options.getOption("dot")); optionsList.add(options.getOption("sdot")); optionsList.add(options.getOption("sampleProfile")); optionsList.add(options.getOption("v")); optionsList.add(options.getOption("h")); CommandLineParser parser = new BasicParser(); CommandLine cmdLine = null; HelpFormatter hf = new HelpFormatter(); hf.setOptionComparator(new OptionComarator<Option>(optionsList)); try { cmdLine = parser.parse(options, args); } catch (ParseException e) { System.err.println(e.getMessage()); hf.printHelp(PROG_NAME, options); System.exit(-1); } Args params = new Args(); if (cmdLine.hasOption("dir")) { params.simPath = cmdLine.getOptionValue("dir") + "/" + SIMULATION_DATA_DIR; } else { System.err.println("Required parameter: output directory path [-dir]"); hf.printHelp(PROG_NAME, options); System.exit(-1); } if (cmdLine.hasOption("t")) { Parameters.NUM_TREES = Integer.parseInt(cmdLine.getOptionValue("t")); } if (cmdLine.hasOption("i")) { Parameters.NUM_ITERATIONS = Integer.parseInt(cmdLine.getOptionValue("i")); } if (cmdLine.hasOption("snv")) { Parameters.PROB_SNV = Double.parseDouble(cmdLine.getOptionValue("snv")); } if (cmdLine.hasOption("cnv")) { Parameters.PROB_CNV = Double.parseDouble(cmdLine.getOptionValue("cnv")); } if (cmdLine.hasOption("probDeath")) { Parameters.PROB_DEATH = Double.parseDouble(cmdLine.getOptionValue("probDeath")); } if (cmdLine.hasOption("maxPopulationSize")) { Parameters.MAX_POPULATION_SIZE = Integer.parseInt(cmdLine.getOptionValue("maxPopulationSize")); } if (cmdLine.hasOption("minNodes")) { Parameters.MIN_NUM_NODES = Integer.parseInt(cmdLine.getOptionValue("minNodes")); if (Parameters.MIN_NUM_NODES < 1) { System.err.println("Minimum number of nodes [-minNodes] must be at least 1"); System.exit(-1); } } if (cmdLine.hasOption("maxNodes")) { Parameters.MAX_NUM_NODES = Integer.parseInt(cmdLine.getOptionValue("maxNodes")); if (Parameters.MAX_NUM_NODES < 1 || Parameters.MAX_NUM_NODES < Parameters.MIN_NUM_NODES) { System.err.println( "Maximum number of nodes [-maxNodes] must be at least 1 and not less than [-minNodes]"); System.exit(-1); } } if (cmdLine.hasOption("s")) { String[] samples = cmdLine.getOptionValues("s"); Parameters.NUM_SAMPLES_ARRAY = new int[samples.length]; for (int i = 0; i < samples.length; i++) { Parameters.NUM_SAMPLES_ARRAY[i] = Integer.parseInt(samples[i]); } } if (cmdLine.hasOption("c")) { String[] cov = cmdLine.getOptionValues("c"); Parameters.COVERAGE_ARRAY = new int[cov.length]; for (int i = 0; i < cov.length; i++) { Parameters.COVERAGE_ARRAY[i] = Integer.parseInt(cov[i]); } } if (cmdLine.hasOption("maxSubclones")) { Parameters.MAX_NUM_SUBCLONES = Integer.parseInt(cmdLine.getOptionValue("maxSubclones")); } if (cmdLine.hasOption("sampleSize")) { Parameters.NUM_CELLS_PER_SAMPLE = Integer.parseInt(cmdLine.getOptionValue("sampleSize")); } if (cmdLine.hasOption("e")) { Parameters.SEQUENCING_ERROR = Double.parseDouble(cmdLine.getOptionValue("e")); } if (cmdLine.hasOption("minNC")) { Parameters.MIN_PERCENT_NORMAL_CONTAMINATION = Double.parseDouble(cmdLine.getOptionValue("minNC")); } if (cmdLine.hasOption("maxNC")) { Parameters.MAX_PERCENT_NORMAL_CONTAMINATION = Double.parseDouble(cmdLine.getOptionValue("maxNC")); } if (Parameters.MAX_PERCENT_NORMAL_CONTAMINATION < Parameters.MIN_PERCENT_NORMAL_CONTAMINATION) { Parameters.MAX_PERCENT_NORMAL_CONTAMINATION = Parameters.MIN_PERCENT_NORMAL_CONTAMINATION; } /*if(cmdLine.hasOption("localized")) { Parameters.LOCALIZED_SAMPLING = true; } if(cmdLine.hasOption("mixSubclone")) { Parameters.MIX_NBR_SUBTREE_SUBCLONE = true; }*/ if (cmdLine.hasOption("dot")) { params.generateDOT = true; } if (cmdLine.hasOption("sampledDot")) { params.generateSampledDOT = true; } if (cmdLine.hasOption("sampleProfile")) { params.outputSampleProfile = true; } if (cmdLine.hasOption("h")) { new HelpFormatter().printHelp(" ", options); } // logger ConsoleHandler h = new ConsoleHandler(); h.setFormatter(new LogFormatter()); h.setLevel(Level.INFO); logger.setLevel(Level.INFO); if (cmdLine.hasOption("v")) { h.setLevel(Level.FINEST); logger.setLevel(Level.FINEST); } logger.addHandler(h); logger.setUseParentHandlers(false); // validate settings if (Parameters.PROB_SNV + Parameters.PROB_CNV + Parameters.PROB_DEATH > 1) { System.err.println("The sum of SSNV, CNV, and cell death probabilities cannot exceed 1"); hf.printHelp(PROG_NAME, options); System.exit(-1); } simulateLineageTrees(params); }
From source file:it.jnrpe.plugins.factory.COption.java
Option toOption() { Option ret = new Option(m_sOption, m_sDescription); if (m_bArgsOptional != null) ret.setOptionalArg(m_bArgsOptional.booleanValue()); if (m_bHasArgs) { if (m_iArgsCount == null) ret.setArgs(Option.UNLIMITED_VALUES); }//from ww w. j av a 2 s . c o m ret.setRequired(m_bRequired); if (m_iArgsCount != null) ret.setArgs(m_iArgsCount.intValue()); if (m_sArgName != null) { if (m_iArgsCount == null) ret.setArgs(Option.UNLIMITED_VALUES); ret.setArgName(m_sArgName); } if (m_sLongOpt != null) ret.setLongOpt(m_sLongOpt); if (m_sValueSeparator != null && m_sValueSeparator.length() != 0) ret.setValueSeparator(m_sValueSeparator.charAt(0)); return ret; }
From source file:com.axelor.shell.core.Target.java
private Options getOptions() { if (options != null) { return options; }/*from www. j a va2 s . c om*/ options = new Options(); int counter = 0; for (CliOption cliOption : cliOptions) { if (cliOption == null) { // variable arguments continue; } Class<?> type = method.getParameterTypes()[counter++]; String name = cliOption.name(); String shortName = "" + cliOption.shortName(); Option option = new Option(shortName, cliOption.help()); option.setType(type); option.setLongOpt(name); option.setRequired(cliOption.required()); option.setArgs(1); if (!isBlank(cliOption.argName())) { option.setArgName(cliOption.argName()); option.setArgs(1); } if (type == boolean.class) { option.setArgs(0); } if (type.isArray()) { option.setArgs(Option.UNLIMITED_VALUES); } options.addOption(option); } return options; }
From source file:kieker.tools.logReplayer.FilesystemLogReplayerStarter.java
@Override protected void addAdditionalOptions(final Options options) { Option option;/*from w ww . j ava 2s . c om*/ option = new Option("c", CMD_OPT_NAME_MONITORING_CONFIGURATION, true, "Configuration to use for the Kieker monitoring instance"); option.setArgName(OPTION_EXAMPLE_FILE_MONITORING_PROPERTIES); option.setRequired(false); option.setValueSeparator('='); options.addOption(option); option = new Option("i", CMD_OPT_NAME_INPUTDIRS, true, "Log directories to read data from"); option.setArgName("dir1 ... dirN"); option.setRequired(false); option.setArgs(Option.UNLIMITED_VALUES); options.addOption(option); option = new Option("k", CMD_OPT_NAME_KEEPORIGINALLOGGINGTIMESTAMPS, true, "Replay the original logging timestamps (defaults to true)?"); option.setArgName("true|false"); option.setRequired(false); option.setValueSeparator('='); options.addOption(option); option = new Option("r", CMD_OPT_NAME_REALTIME, true, "Replay log data in realtime?"); option.setArgName("true|false"); option.setRequired(false); option.setValueSeparator('='); options.addOption(option); option = new Option("n", CMD_OPT_NAME_NUM_REALTIME_WORKERS, true, "Number of worker threads used in realtime mode (defaults to 1)."); option.setArgName("num"); option.setRequired(false); options.addOption(option); option = new Option("a", CMD_OPT_NAME_REALTIME_ACCELERATION_FACTOR, true, "Factor by which to accelerate (>1.0) or slow down (<1.0) the replay in realtime mode (defaults to 1.0, i.e., no acceleration/slow down)."); option.setArgName("factor"); option.setRequired(false); option.setValueSeparator('='); options.addOption(option); option = new Option(null, CMD_OPT_NAME_IGNORERECORDSBEFOREDATE, true, "Records logged before this date (UTC timezone) are ignored (disabled by default)."); option.setArgName(DATE_FORMAT_PATTERN_CMD_USAGE_HELP); option.setRequired(false); options.addOption(option); option = new Option(null, CMD_OPT_NAME_IGNORERECORDSAFTERDATE, true, "Records logged after this date (UTC timezone) are ignored (disabled by default)."); option.setArgName(DATE_FORMAT_PATTERN_CMD_USAGE_HELP); option.setRequired(false); options.addOption(option); }
From source file:net.ripe.rpki.validator.cli.CommandLineOptions.java
private void addCommandGroup() { OptionGroup group = new OptionGroup(); Option helpOption = new Option("h", HELP, false, "Show usage information"); group.addOption(helpOption);/*from w w w .ja v a 2s .com*/ Option versionOption = new Option(null, VERSION, false, "Show version information"); group.addOption(versionOption); Option printOption = new Option("p", PRINT, false, "Show the certificate repository object in a readable format"); group.addOption(printOption); Option talOption = new Option("t", TAL, true, "Trust Anchor Locator (TAL). Can be specified more than once."); talOption.setArgs(Option.UNLIMITED_VALUES); group.addOption(talOption); group.setRequired(true); options.addOptionGroup(group); }
From source file:net.ripe.rpki.validator.cli.CommandLineOptions.java
private void addOptions() { options.addOption("f", FILE, true, "Certificate repository object file"); options.addOption(null, PREFETCH, true, "Prefetch specified rsync URI before top-down validation. Can be specified more than once."); options.getOption(PREFETCH).setArgs(Option.UNLIMITED_VALUES); options.addOption("o", OUTPUT_DIR, true, "Output directory for the results of top-down validation and the trust anchor file"); options.addOption("r", ROA_EXPORT, true, "Export routing authorisation found in validated ROAs"); options.addOption("v", VERBOSE, false, "Show all validation steps"); }
From source file:net.sourceforge.dita4publishers.tools.ditadxpunpacker.DitaDxpUnpacker.java
/** * @return//from www . j a v a 2 s.c o m */ 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.oneops.boo.BooCli.java
/** * Instantiates a new boo cli./*from ww w. ja v a 2s . com*/ */ public BooCli() { Option help = new Option("h", "help", false, "show help."); Option create = Option.builder("c").longOpt("create").desc( "Create a new Assembly specified by -f. If Assembly automatic naming is enabled, each invocation will create a new Assembly.") .build(); Option update = Option.builder("u").longOpt("update").desc("Update configurations specified by -f.") .build(); Option status = Option.builder("s").longOpt("status").desc("Get status of deployments specified by -f") .build(); Option config = Option.builder("f").longOpt("config-file").argName("FILE").hasArg() .desc("Use specified Boo YAML file").build(); Option cleanup = Option.builder("r").longOpt("remove") .desc("Remove all deployed configurations specified by -f").build(); Option list = Option.builder("l").longOpt("list").numberOfArgs(1).optionalArg(Boolean.TRUE) .desc("Return a list of instances applicable to the identifier provided..").build(); Option force = Option.builder().longOpt("force").desc("Do not prompt for --remove").build(); Option nodeploy = Option.builder().longOpt("no-deploy").desc("Create assembly without deployments").build(); Option getIps = Option.builder().longOpt("get-ips").argName("environment> <compute-class") .desc("Get IPs of deployed nodes specified by -f; Args are optional.").build(); getIps.setOptionalArg(true); getIps.setArgs(Option.UNLIMITED_VALUES); Option retry = Option.builder().longOpt("retry").desc("Retry deployments of configurations specified by -f") .build(); Option quiet = Option.builder().longOpt("quiet").desc("Silence the textual output.").build(); Option assembly = Option.builder("a").longOpt("assembly").hasArg().desc("Override the assembly name.") .build(); Option action = Option.builder().longOpt("procedure").numberOfArgs(3).optionalArg(Boolean.TRUE) .argName("platform> <component> <action") .desc("Execute actions. Use 'list' as an action to show available actions.").build(); Option procedureArguments = Option.builder().longOpt("procedure-arguments").argName("arglist").hasArg() .desc("Arguments to pass to the procedure call. Example: '{\"backup_type\":\"incremental\"}'") .build(); Option instanceList = Option.builder().longOpt("procedure-instances").argName("instanceList").hasArg().desc( "Comma-separated list of component instance names. 'list' to show all available component instances.") .build(); Option stepSize = Option.builder().longOpt("procedure-step-size").argName("size").hasArg() .desc("Percent of nodes to perform procedure on, default is 100.").build(); Option comment = Option.builder("m").longOpt("message").argName("description").hasArg() .desc("Customize the comment for deployments").build(); Option view = Option.builder("v").longOpt("view").desc("View interpolated Boo YAML template").build(); Option profile = Option.builder("p").longOpt("profile").argName("PROFILE").hasArg() .desc("Choose specific profile from ~/.boo/config").build(); options.addOption(help); options.addOption(config); options.addOption(create); options.addOption(update); options.addOption(status); options.addOption(list); options.addOption(cleanup); options.addOption(getIps); options.addOption(retry); options.addOption(quiet); options.addOption(force); options.addOption(nodeploy); options.addOption(assembly); options.addOption(action); options.addOption(procedureArguments); options.addOption(instanceList); options.addOption(stepSize); options.addOption(comment); options.addOption(view); options.addOption(profile); }
From source file:de.uni_koblenz.jgralab.gretl.GReTLRunner.java
public GReTLRunner() { String toolString = "java " + GReTLRunner.class.getName(); String versionString = JGraLab.getInfo(false); oh = new OptionHandler(toolString, versionString); Option transform = new Option("t", "transformation", true, "(required) The GReTL transformation that should be executed."); transform.setArgName("gretl-file"); transform.setRequired(true);/*from ww w .j a v a2 s. co m*/ oh.addOption(transform); Option schema = new Option("s", "schema", true, "(optional) The name of the target schema. " + "Defaults to foo.bar.BazSchema."); schema.setArgName("schema-name"); schema.setRequired(false); oh.addOption(schema); Option graphclass = new Option("g", "graphclass", true, "(optional) The name of the target graph class. " + "Defaults to BazGraph."); graphclass.setArgName("graphclass"); graphclass.setRequired(false); oh.addOption(graphclass); Option viz = new Option("z", "visualize", false, "(optional) Additionally create a PDF viz of the output graph."); viz.setRequired(false); oh.addOption(viz); Option reverseViz = new Option("r", "reverse-edges", false, "(optional) When -z is given, print edges pointing bottom-up."); reverseViz.setRequired(false); oh.addOption(reverseViz); Option debugExecution = new Option("d", "debug", false, "(optional) Print the target graph after each transformation op."); debugExecution.setRequired(false); oh.addOption(debugExecution); Option output = new Option("o", "output", true, "(optional) The file to store the target graph to. If many input " + "models are to be transformed, this has no effect."); output.setRequired(false); debugExecution.setArgName("target-graph-file"); oh.addOption(output); // TODO: Basically, -u should exclude the usage of -s/-g. Option useSourceSchema = new Option("u", "use-source-schema", false, "(optional) Use the source schema as target schema. " + "In that case, no schema modifications may be performed by the transformation."); useSourceSchema.setRequired(false); oh.addOption(useSourceSchema); // TODO: Basically, -i should exclude the usage of -s/-g. Option inPlace = new Option("i", "in-place", false, "(optional) Use the source graph as target graph. " + "In that case, no schema modifications may be performed by the transformation."); inPlace.setRequired(false); oh.addOption(inPlace); oh.setArgumentCount(Option.UNLIMITED_VALUES); oh.setArgumentName("input-graph"); oh.setOptionalArgument(false); }
From source file:com.zimbra.perf.chart.ChartUtil.java
private static Options getOptions() { Options opts = new Options(); opts.addOption("h", OPT_HELP, false, "prints this usage screen"); Option confOption = new Option("c", OPT_CONF, true, "chart configuration xml files"); confOption.setArgs(Option.UNLIMITED_VALUES); confOption.setRequired(true);//from w ww.jav a2 s . com opts.addOption(confOption); Option srcDirOption = new Option("s", OPT_SRCDIR, true, "one or more directories where the csv files are located"); srcDirOption.setArgs(Option.UNLIMITED_VALUES); opts.addOption(srcDirOption); Option destDirOption = new Option("d", OPT_DESTDIR, true, "directory where the generated chart files are saved"); opts.addOption(destDirOption); opts.addOption(null, OPT_TITLE, true, "chart title; defaults to last directory name of --" + OPT_SRCDIR + " value"); opts.addOption(null, OPT_START_AT, true, "if specified, ignore all samples before this timestamp (MM/dd/yyyy HH:mm:ss)"); opts.addOption(null, OPT_END_AT, true, "if specified, ignore all samples after this timestamp (MM/dd/yyyy HH:mm:ss)"); opts.addOption(null, OPT_AGGREGATE_START_AT, true, "if specified, aggregate computation starts at this timestamp (MM/dd/yyyy HH:mm:ss)"); opts.addOption(null, OPT_AGGREGATE_END_AT, true, "if specified, aggregate computation ends at this timestamp (MM/dd/yyyy HH:mm:ss)"); opts.addOption(null, OPT_NO_SUMMARY, false, "skip summary data generation"); return opts; }