use of org.apache.commons.cli.Option in project zm-mailbox by Zimbra.
the class VolumeCLI method setupCommandLineOptions.
@Override
protected void setupCommandLineOptions() {
super.setupCommandLineOptions();
Options options = getOptions();
OptionGroup og = new OptionGroup();
og.addOption(new Option(O_A, "add", false, "Adds a volume."));
og.addOption(new Option(O_D, "delete", false, "Deletes a volume."));
og.addOption(new Option(O_L, "list", false, "Lists volumes."));
og.addOption(new Option(O_E, "edit", false, "Edits a volume."));
og.addOption(new Option(O_DC, "displayCurrent", false, "Displays the current volumes."));
og.addOption(new Option(O_SC, "setCurrent", false, "Sets the current volume."));
og.addOption(new Option(O_TS, "turnOffSecondary", false, "Turns off the current secondary message volume"));
og.setRequired(true);
options.addOptionGroup(og);
options.addOption(O_ID, "id", true, "Volume ID");
options.addOption(O_T, "type", true, "Volume type (primaryMessage, secondaryMessage, or index)");
options.addOption(O_N, "name", true, "volume name");
options.addOption(O_P, "path", true, "Root path");
options.addOption(O_C, "compress", true, "Compress blobs; \"true\" or \"false\"");
options.addOption(O_CT, "compressionThreshold", true, "Compression threshold; default 4KB");
options.addOption(SoapCLI.OPT_AUTHTOKEN);
options.addOption(SoapCLI.OPT_AUTHTOKENFILE);
}
use of org.apache.commons.cli.Option in project apex-core by apache.
the class ApexCli method getShowLogicalPlanCommandLineOptions.
@SuppressWarnings("static-access")
public static Options getShowLogicalPlanCommandLineOptions() {
Options options = new Options();
Option libjars = OptionBuilder.withArgName("comma separated list of jars").hasArg().withDescription("Specify comma separated jar/resource files to include in the classpath.").create("libjars");
Option ignorePom = new Option("ignorepom", "Do not run maven to find the dependency");
Option exactMatch = new Option("exactMatch", "Only consider exact match for app name");
options.addOption(libjars);
options.addOption(ignorePom);
options.addOption(exactMatch);
return options;
}
use of org.apache.commons.cli.Option in project incubator-systemml by apache.
the class DMLScript method createCLIOptions.
/**
* Creates an {@link Options} instance for the command line parameters
* As of SystemML 0.13, Apache Commons CLI 1.2 is transitively in the classpath
* However the most recent version of Apache Commons CLI is 1.4
* Creating CLI options is done using Static methods. This obviously makes it
* thread unsafe. Instead of {@link OptionBuilder}, CLI 1.4 uses Option.Builder which
* has non-static methods.
* @return an appropriate instance of {@link Options}
*/
@SuppressWarnings("static-access")
public static Options createCLIOptions() {
Options options = new Options();
Option nvargsOpt = OptionBuilder.withArgName("key=value").withDescription("parameterizes DML script with named parameters of the form <key=value>; <key> should be a valid identifier in DML/PyDML").hasArgs().create("nvargs");
Option argsOpt = OptionBuilder.withArgName("argN").withDescription("specifies positional parameters; first value will replace $1 in DML program; $2 will replace 2nd and so on").hasArgs().create("args");
Option configOpt = OptionBuilder.withArgName("filename").withDescription("uses a given configuration file (can be on local/hdfs/gpfs; default values in SystemML-config.xml").hasArg().create("config");
Option cleanOpt = OptionBuilder.withDescription("cleans up all SystemML working directories (FS, DFS); all other flags are ignored in this mode. \n").create("clean");
Option statsOpt = OptionBuilder.withArgName("count").withDescription("monitors and reports caching/recompilation statistics; heavy hitter <count> is 10 unless overridden; default off").hasOptionalArg().create("stats");
Option explainOpt = OptionBuilder.withArgName("level").withDescription("explains plan levels; can be 'hops' / 'runtime'[default] / 'recompile_hops' / 'recompile_runtime'").hasOptionalArg().create("explain");
Option execOpt = OptionBuilder.withArgName("mode").withDescription("sets execution mode; can be 'hadoop' / 'singlenode' / 'hybrid'[default] / 'hybrid_spark' / 'spark'").hasArg().create("exec");
Option gpuOpt = OptionBuilder.withArgName("force").withDescription("uses CUDA instructions when reasonable; set <force> option to skip conservative memory estimates and use GPU wherever possible; default off").hasOptionalArg().create("gpu");
Option debugOpt = OptionBuilder.withDescription("runs in debug mode; default off").create("debug");
Option pythonOpt = OptionBuilder.withDescription("parses Python-like DML").create("python");
Option fileOpt = OptionBuilder.withArgName("filename").withDescription("specifies dml/pydml file to execute; path can be local/hdfs/gpfs (prefixed with appropriate URI)").isRequired().hasArg().create("f");
Option scriptOpt = OptionBuilder.withArgName("script_contents").withDescription("specified script string to execute directly").isRequired().hasArg().create("s");
Option helpOpt = OptionBuilder.withDescription("shows usage message").create("help");
OptionGroup fileOrScriptOpt = new OptionGroup();
// Either a clean(-clean), a file(-f), a script(-s) or help(-help) needs to be specified
fileOrScriptOpt.addOption(scriptOpt);
fileOrScriptOpt.addOption(fileOpt);
fileOrScriptOpt.addOption(cleanOpt);
fileOrScriptOpt.addOption(helpOpt);
fileOrScriptOpt.setRequired(true);
OptionGroup argsOrNVArgsOpt = new OptionGroup();
// Either -args or -nvargs
argsOrNVArgsOpt.addOption(nvargsOpt).addOption(argsOpt);
options.addOption(configOpt);
options.addOption(cleanOpt);
options.addOption(statsOpt);
options.addOption(explainOpt);
options.addOption(execOpt);
options.addOption(gpuOpt);
options.addOption(debugOpt);
options.addOption(pythonOpt);
options.addOptionGroup(fileOrScriptOpt);
options.addOptionGroup(argsOrNVArgsOpt);
options.addOption(helpOpt);
return options;
}
use of org.apache.commons.cli.Option in project ignite by apache.
the class GridRandomCommandLineLoader method createOptions.
/**
* Creates cli options.
*
* @return Command line options
*/
private static Options createOptions() {
Options options = new Options();
Option help = new Option(OPTION_HELP, "print this message");
Option cfg = new Option(null, OPTION_CFG, true, "path to Spring XML configuration file.");
cfg.setValueSeparator('=');
cfg.setType(String.class);
Option minTtl = new Option(null, OPTION_MIN_TTL, true, "node minimum time to live.");
minTtl.setValueSeparator('=');
minTtl.setType(Long.class);
Option maxTtl = new Option(null, OPTION_MAX_TTL, true, "node maximum time to live.");
maxTtl.setValueSeparator('=');
maxTtl.setType(Long.class);
Option duration = new Option(null, OPTION_DURATION, true, "run timeout.");
duration.setValueSeparator('=');
duration.setType(Long.class);
Option log = new Option(null, OPTION_LOG_CFG, true, "path to log4j configuration file.");
log.setValueSeparator('=');
log.setType(String.class);
options.addOption(help);
OptionGroup grp = new OptionGroup();
grp.setRequired(true);
grp.addOption(cfg);
grp.addOption(minTtl);
grp.addOption(maxTtl);
grp.addOption(duration);
grp.addOption(log);
options.addOptionGroup(grp);
return options;
}
use of org.apache.commons.cli.Option in project incubator-systemml by apache.
the class DMLDebuggerInterface method setOptions.
/**
* Set DML debugger CLI functionality menu
*/
@SuppressWarnings("static-access")
public void setOptions() {
//add help option
options.addOption("h", "help", false, "list debugger functions");
//add run option
options.addOption("r", "run", false, "start your DML script");
//add quit option
options.addOption("q", "quit", false, "exit debug mode");
//add resume option
options.addOption("c", "continue", false, "continue running your DML script");
//add step over
//options.addOption("n", "next", false, "next line, stepping over function calls");
//add single-stepping
options.addOption("s", "step", false, "next line, stepping into function calls");
//add single-stepping
options.addOption("si", "stepi", false, "next runtime instruction rather than DML source lines (for advanced users)");
// No step return for now
//add step return
// Option stepReturn = OptionBuilder.withArgName( "function-name" )
// .hasOptionalArg()
// .withDescription( "execute instructions associated with current function as single step")
// .create( "step_return" );
// options.addOption(stepReturn);
//add set breakpoint option
Option setBreakpoint = OptionBuilder.withLongOpt("break").withArgName("line-number").hasArg().withDescription("set breakpoint at given line number").create("b");
options.addOption(setBreakpoint);
// The key assumption here is that user doesnot keep toggling breakpoints too often
//add delete breakpoint option
Option disableBreakpoint = OptionBuilder.withLongOpt("delete").withArgName("line-number").hasArg().withDescription("delete breakpoint at given line number").create("d");
options.addOption(disableBreakpoint);
//add list breakpoints option
Option infoOption = OptionBuilder.withLongOpt("info").withArgName("[break | frame]").hasOptionalArgs(1).withDescription("show all breakpoints or frames (info <break | frame>)").create("i");
options.addOption(infoOption);
//add display DML script option
Option displayScript = OptionBuilder.withLongOpt("list").withArgName("[next numlines] | [prev numlines] | [all]").hasOptionalArgs(2).withValueSeparator(' ').withDescription("display DML script source lines. Default: numlines = 10").create("l");
options.addOption(displayScript);
//add display DML script interspersed with runtime instructions option
Option displayInst = OptionBuilder.withLongOpt("listi").withArgName("[next numlines] | [prev numlines] | [all]").hasOptionalArgs(2).withValueSeparator(' ').withDescription("display corresponding instructions for DML script source lines. Default: numlines = 10 (for advanced users)").create("li");
options.addOption(displayInst);
//add set value of DML scalar variable option
Option setVar = OptionBuilder.withArgName("varName value").hasArgs(2).withValueSeparator(' ').withDescription("set value of a scalar or specified cell of a matrix variable. (Eg: \'set alpha 0.1\' or \'set A[1,2] 20\')").create("set");
options.addOption(setVar);
//add display DML matrix (or vector) variable option
Option displayMatrix = OptionBuilder.withLongOpt("print").withArgName("varName").hasArg().withDescription("display contents of a scalar or matrix variable or rows/columns/cell of matrix. (Eg: \'p alpha\' or \'p A\' or \'p A[1,]\')").create("p");
options.addOption(displayMatrix);
Option displayTypeMatrix = //.withLongOpt( "whatis" )
OptionBuilder.withArgName("varName").hasArg().withDescription("display the type (and metadata) of a variable. (Eg: \'whatis alpha\' or \'whatis A\')").create("whatis");
options.addOption(displayTypeMatrix);
}
Aggregations