本文整理了Java中org.apache.commons.cli.Option.setLongOpt()
方法的一些代码示例,展示了Option.setLongOpt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.setLongOpt()
方法的具体详情如下:
包路径:org.apache.commons.cli.Option
类名称:Option
方法名:setLongOpt
[英]Sets the long name of this Option.
[中]设置此选项的长名称。
代码示例来源:origin: commons-cli/commons-cli
option.setLongOpt(longopt);
option.setRequired(required);
option.setOptionalArg(optionalArg);
代码示例来源:origin: apache/tika
private Option buildOption(Node optionNode) {
NamedNodeMap map = optionNode.getAttributes();
String opt = getString(map, "opt", "");
String description = getString(map, "description", "");
String longOpt = getString(map, "longOpt", "");
boolean isRequired = getBoolean(map, "required", false);
boolean hasArg = getBoolean(map, "hasArg", false);
if(opt.trim().length() == 0 || description.trim().length() == 0) {
throw new IllegalArgumentException(
"Must specify at least option and description");
}
Option option = new Option(opt, description);
if (longOpt.trim().length() > 0) {
option.setLongOpt(longOpt);
}
if (isRequired) {
option.setRequired(true);
}
if (hasArg) {
option.setArgs(1);
}
return option;
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
private Option createAnOptionWithArgument(String[] argInfo)
{
OptionBuilder.withArgName(argInfo[0]);
OptionBuilder.hasArg();
OptionBuilder.withDescription(argInfo[2]);
Option opt = OptionBuilder.create( argInfo[0]);
if (!isStringEmpty(argInfo[1]))
{
opt.setLongOpt(argInfo[1]);
}
return opt;
}
代码示例来源:origin: realXuJiang/bigtable-sql
private Option createAnOption(String[] argInfo)
{
Option opt = new Option(argInfo[0], argInfo[2]);
if (!isStringEmpty(argInfo[1]))
{
opt.setLongOpt(argInfo[1]);
}
return opt;
}
代码示例来源:origin: realXuJiang/bigtable-sql
private Option createAnOptionWithArgument(String[] argInfo)
{
OptionBuilder.withArgName(argInfo[0]);
OptionBuilder.hasArg();
OptionBuilder.withDescription(argInfo[2]);
Option opt = OptionBuilder.create( argInfo[0]);
if (!isStringEmpty(argInfo[1]))
{
opt.setLongOpt(argInfo[1]);
}
return opt;
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
private Option createAnOption(String[] argInfo)
{
Option opt = new Option(argInfo[0], argInfo[2]);
if (!isStringEmpty(argInfo[1]))
{
opt.setLongOpt(argInfo[1]);
}
return opt;
}
代码示例来源:origin: org.apache.pig/pig
private Options populateValidOptions() {
Options validOptions = new Options();
validOptions.addOption("schema", false, "Loads / Stores the schema of the relation using a hidden JSON file.");
validOptions.addOption("noschema", false, "Disable attempting to load data schema from the filesystem.");
validOptions.addOption(TAG_SOURCE_FILE, false, "Appends input source file name to beginning of each tuple.");
validOptions.addOption(TAG_SOURCE_PATH, false, "Appends input source file path to beginning of each tuple.");
validOptions.addOption("tagsource", false, "Appends input source file name to beginning of each tuple.");
Option overwrite = new Option("overwrite", "Overwrites the destination.");
overwrite.setLongOpt("overwrite");
overwrite.setOptionalArg(true);
overwrite.setArgs(1);
overwrite.setArgName("overwrite");
validOptions.addOption(overwrite);
return validOptions;
}
代码示例来源:origin: org.parallelj/parallelj-launching
public SyncLaunchArgsOption() {
this.option = OptionBuilder.create("a");
this.option.setLongOpt("args");
this.option.setArgs(100);
this.option.setArgName("arg1=value1 arg2=value2 ... argx=valueX");
this.option.setDescription("Arguments of the Program");
this.option.setRequired(false);
}
代码示例来源:origin: org.parallelj/parallelj-launching
public SyncLaunchIdOption() {
this.option = OptionBuilder.create("i");
this.option.setLongOpt("id");
this.option.setArgs(1);
this.option.setArgName("id");
this.option.setDescription("Id of the Program from the list return by ll command");
this.option.setRequired(true);
}
代码示例来源:origin: org.parallelj/parallelj-launching
public AsyncLaunchArgsOption() {
this.option = OptionBuilder.create("a");
this.option.setLongOpt("args");
this.option.setArgs(100);
this.option.setArgName("arg1=value1 arg2=value2 ... argx=valueX");
this.option.setDescription("Arguments of the Program");
this.option.setRequired(false);
}
代码示例来源:origin: org.parallelj/parallelj-launching
public AsyncLaunchIdOption() {
this.option = OptionBuilder.create("i");
this.option.setLongOpt("id");
this.option.setArgs(1);
this.option.setArgName("id");
this.option
.setDescription("Id of the Program from the list return by ll command");
this.option.setRequired(true);
}
代码示例来源:origin: soulgalore/crawler
/**
* Get the options.
*
* @return the specific CrawlToCsv options
*/
@Override
protected Options getOptions() {
final Options options = super.getOptions();
final Option filenameOption =
new Option("f", "the name of the csv output file, default name is " + DEFAULT_FILENAME
+ " [optional]");
filenameOption.setArgName("FILENAME");
filenameOption.setLongOpt("filename");
filenameOption.setRequired(false);
filenameOption.setArgs(1);
options.addOption(filenameOption);
return options;
}
}
代码示例来源:origin: com.soulgalore/crawler
/**
* Get the options.
*
* @return the specific CrawlToCsv options
*/
@Override
protected Options getOptions() {
final Options options = super.getOptions();
final Option filenameOption =
new Option("k", "the keyword to search for in the page [required]");
filenameOption.setArgName("KEYWORD");
filenameOption.setLongOpt("keyword");
filenameOption.setRequired(true);
filenameOption.setArgs(1);
options.addOption(filenameOption);
return options;
}
}
代码示例来源:origin: soulgalore/crawler
/**
* Get the options.
*
* @return the specific CrawlToCsv options
*/
@Override
protected Options getOptions() {
final Options options = super.getOptions();
final Option filenameOption =
new Option("k", "the keyword to search for in the page [required]");
filenameOption.setArgName("KEYWORD");
filenameOption.setLongOpt("keyword");
filenameOption.setRequired(true);
filenameOption.setArgs(1);
options.addOption(filenameOption);
return options;
}
}
代码示例来源:origin: com.soulgalore/crawler
/**
* Get the options.
*
* @return the specific CrawlToCsv options
*/
@Override
protected Options getOptions() {
final Options options = super.getOptions();
final Option filenameOption =
new Option("f", "the name of the csv output file, default name is " + DEFAULT_FILENAME
+ " [optional]");
filenameOption.setArgName("FILENAME");
filenameOption.setLongOpt("filename");
filenameOption.setRequired(false);
filenameOption.setArgs(1);
options.addOption(filenameOption);
return options;
}
}
代码示例来源:origin: org.fusesource.hawtjni/hawtjni-generator
public Option op() {
Option option = new Option( id!=null ? id : " ", description );
option.setLongOpt(name);
option.setRequired( required );
option.setOptionalArg(optional);
option.setType( type );
option.setValueSeparator(sperator);
if( arg !=null && args==-1 ) {
args=1;
}
option.setArgs(args);
option.setArgName(arg);
return option;
}
代码示例来源:origin: NationalSecurityAgency/datawave
/**
* Creates an Option using OptionBuilder's State and the given parameters.
*
* @param opt
* short representation of the option
* @param longOpt
* long representation of the option
* @param desc
* descibes the function of the option
* @return the new Option
*/
public Option create(final String opt, final String longOpt, final String desc) {
final Option option = new Option(opt, desc);
option.setLongOpt(longOpt);
option.setArgs(args);
option.setRequired(required);
option.setOptionalArg(optionalArg);
option.setType(type);
option.setValueSeparator(valSeparator);
return option;
}
代码示例来源:origin: org.apache.activemq/apollo-util
public Option op() {
Option option = new Option( id!=null ? id : " ", description );
option.setLongOpt(name);
option.setRequired( required );
option.setOptionalArg(optional);
option.setType( type );
option.setValueSeparator(sperator);
if( arg !=null && args==-1 ) {
args=1;
}
option.setArgs(args);
option.setArgName(arg);
return option;
}
代码示例来源:origin: fusesource/hawtjni
public Option op() {
Option option = new Option( id!=null ? id : " ", description );
option.setLongOpt(name);
option.setRequired( required );
option.setOptionalArg(optional);
option.setType( type );
option.setValueSeparator(sperator);
if( arg !=null && args==-1 ) {
args=1;
}
option.setArgs(args);
option.setArgName(arg);
return option;
}
代码示例来源:origin: org.cytoscape/cy-commons-cli
/**
* Create an Option using the current settings and with
* the specified Option <code>char</code>.
*
* @param opt the <code>java.lang.String</code> representation
* of the Option
* @return the Option instance
* @throws IllegalArgumentException if <code>opt</code> is not
* a valid character. See Option.
*/
public static Option create(String opt) throws IllegalArgumentException {
// create the option
Option option = new Option(opt, description);
// set the option properties
option.setLongOpt(longopt);
option.setRequired(required);
option.setOptionalArg(optionalArg);
option.setArgs(numberOfArgs);
option.setType(type);
option.setValueSeparator(valuesep);
option.setArgName(argName);
// reset the OptionBuilder properties
OptionBuilder.reset();
// return the Option instance
return option;
}
}
内容来源于网络,如有侵权,请联系作者删除!