本文整理汇总了Java中org.apache.commons.cli.OptionBuilder.withLongOpt方法的典型用法代码示例。如果您正苦于以下问题:Java OptionBuilder.withLongOpt方法的具体用法?Java OptionBuilder.withLongOpt怎么用?Java OptionBuilder.withLongOpt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.cli.OptionBuilder
的用法示例。
在下文中一共展示了OptionBuilder.withLongOpt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Build command-line options and descriptions
*
* @return command line options
*/
public static Options buildOptions() {
Options options = new Options();
// Build in/output file arguments, which are required, but there is no
// addOption method that can specify this
OptionBuilder.isRequired();
OptionBuilder.hasArgs();
OptionBuilder.withLongOpt("outputFilename");
options.addOption(OptionBuilder.create("o"));
OptionBuilder.isRequired();
OptionBuilder.hasArgs();
OptionBuilder.withLongOpt("inputFilename");
options.addOption(OptionBuilder.create("i"));
options.addOption("p", "processor", true, "");
options.addOption("v", "verbose", false, "");
options.addOption("f", "fix-txids", false, "");
options.addOption("r", "recover", false, "");
options.addOption("h", "help", false, "");
return options;
}
示例2: buildOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Build command-line options and descriptions
*/
public static Options buildOptions() {
Options options = new Options();
// Build in/output file arguments, which are required, but there is no
// addOption method that can specify this
OptionBuilder.isRequired();
OptionBuilder.hasArgs();
OptionBuilder.withLongOpt("outputFile");
options.addOption(OptionBuilder.create("o"));
OptionBuilder.isRequired();
OptionBuilder.hasArgs();
OptionBuilder.withLongOpt("inputFile");
options.addOption(OptionBuilder.create("i"));
options.addOption("p", "processor", true, "");
options.addOption("h", "help", false, "");
options.addOption("skipBlocks", false, "");
options.addOption("printToScreen", false, "");
options.addOption("delimiter", true, "");
return options;
}
示例3: buildOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Build command-line options and descriptions
*/
private static Options buildOptions() {
Options options = new Options();
// Build in/output file arguments, which are required, but there is no
// addOption method that can specify this
OptionBuilder.isRequired();
OptionBuilder.hasArgs();
OptionBuilder.withLongOpt("inputFile");
options.addOption(OptionBuilder.create("i"));
options.addOption("o", "outputFile", true, "");
options.addOption("p", "processor", true, "");
options.addOption("h", "help", false, "");
options.addOption("maxSize", true, "");
options.addOption("step", true, "");
options.addOption("addr", true, "");
options.addOption("delimiter", true, "");
options.addOption("t", "temp", true, "");
return options;
}
示例4: AddFind
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
public AddFind() {
super("add", "a");
OptionBuilder.withArgName("outputDir");
OptionBuilder.withLongOpt("output");
OptionBuilder.hasArg();
OptionBuilder.withDescription("override default download directory");
OptionBuilder.withType(File.class);
getOptions().addOption(OptionBuilder.create('o'));
getOptions().addOption("r", "recurse", false,
"recurse sub-directories.");
getOptions().addOption("f", "find", false,
"only find files, don't add.");
getOptions().addOption("h", "help", false,
"display help about this command");
getOptions()
.addOption("l", "list", false, "list previous find results");
}
示例5: AddFind
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
public AddFind()
{
super("add", "a");
OptionBuilder.withArgName("outputDir");
OptionBuilder.withLongOpt("output");
OptionBuilder.hasArg();
OptionBuilder.withDescription("override default download directory");
OptionBuilder.withType(File.class);
getOptions().addOption( OptionBuilder.create('o') );
getOptions().addOption("r", "recurse", false, "recurse sub-directories.");
getOptions().addOption("f", "find", false, "only find files, don't add.");
getOptions().addOption("h", "help", false, "display help about this command");
getOptions().addOption("l", "list", false, "list previous find results");
}
示例6: createCommandLineOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Creates the command line structure / options.
*
* @return the command line {@link Options}
*/
private static Options createCommandLineOptions() {
Options options = new Options();
OptionBuilder.withLongOpt("keyword-properties");
OptionBuilder.withDescription("Location of the keyword-optimizer.properties file.");
OptionBuilder.hasArg(true);
OptionBuilder.withArgName("file");
options.addOption(OptionBuilder.create("kp"));
OptionBuilder.withLongOpt("ads-properties");
OptionBuilder.withDescription("Location of the ads.properties file.");
OptionBuilder.hasArg(true);
OptionBuilder.withArgName("file");
options.addOption(OptionBuilder.create("ap"));
OptionBuilder.withLongOpt("port");
OptionBuilder.withDescription("Port for the REST HTTP server.");
OptionBuilder.hasArg(true);
OptionBuilder.withArgName("port");
options.addOption(OptionBuilder.create("p"));
OptionBuilder.withLongOpt("context-path");
OptionBuilder.withDescription("Context path for the REST HTTP server.");
OptionBuilder.hasArg(true);
OptionBuilder.withArgName("path");
options.addOption(OptionBuilder.create("cp"));
return options;
}
示例7: buildOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Method for building the allowed options.
* @param options Options object for adding the options created with OptionBuilder.
*/
private void buildOptions(Options options){
OptionBuilder.withArgName(OPTION_HELP);
OptionBuilder.withLongOpt(OPTION_HELP);
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("Print help message and exit.");
options.addOption(OptionBuilder.create('h'));
OptionBuilder.withArgName(OPTION_INPUT_JSON);
OptionBuilder.withLongOpt(OPTION_INPUT_JSON);
OptionBuilder.isRequired(false);
OptionBuilder.hasArg();
OptionBuilder.withDescription("Specify the JSON input file.");
options.addOption(OptionBuilder.create("j"));
}
示例8: parseArgs
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Method to parse specific arguments for "Analyze".
*/
@Override
protected final void parseArgs(String[] args) throws AdeException {
final Options options = new Options();
OptionBuilder.withArgName(OPTION_SOURCES);
OptionBuilder.withLongOpt(OPTION_SOURCES);
OptionBuilder.isRequired(false);
OptionBuilder.hasArg();
OptionBuilder.withDescription("Specify the Source to be analyzed. ");
options.addOption(OptionBuilder.create("s"));
super.parseArgs(options, args);
}
示例9: buildOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
public static Options buildOptions(Options subClassOptions) {
/* Add the options from subClass */
Options options = new Options();
for (Object subClassOption : subClassOptions.getOptions()) {
Option option = (Option) subClassOption;
options.addOption(option);
}
/* Add the general options */
OptionBuilder.withArgName(OPTION_HELP);
OptionBuilder.withLongOpt(OPTION_HELP);
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("Print help message and exit");
options.addOption(OptionBuilder.create('h'));
OptionBuilder.withArgName(OPTION_INPUT_FILE);
OptionBuilder.withLongOpt(OPTION_INPUT_FILE);
OptionBuilder.hasArg();
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("Input file name or 'stdin'");
options.addOption(OptionBuilder.create('f'));
OptionBuilder.withArgName(OPTION_INPUT_DIR);
OptionBuilder.withLongOpt(OPTION_INPUT_DIR);
OptionBuilder.hasArg();
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("Input dir name");
options.addOption(OptionBuilder.create('d'));
OptionBuilder.withArgName(OPTION_SOURCES);
OptionBuilder.withLongOpt(OPTION_SOURCES);
OptionBuilder.hasArg();
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("Source Names.");
options.addOption(OptionBuilder.create('s'));
OptionBuilder.withArgName(OPTION_OS_TYPE);
OptionBuilder.withLongOpt(OPTION_OS_TYPE);
OptionBuilder.hasArg();
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("The OS Type."
+ "If this option is omitted, the default is Linux");
options.addOption(OptionBuilder.create('o'));
OptionBuilder.withArgName(OPTION_GMT_OFFSET);
OptionBuilder.withLongOpt(OPTION_GMT_OFFSET);
OptionBuilder.hasArg();
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("hours offset from GMT");
options.addOption(OptionBuilder.create('g'));
return options;
}
示例10: buildOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
static Options buildOptions(final Locale locale) {
final ResourceBundle bundle = Setup.getResourceBundle(locale);
final Options options = new Options();
// help
OptionBuilder.withLongOpt("help");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription(bundle.getString("arg.help"));
options.addOption(OptionBuilder.create('?'));
// force
OptionBuilder.withLongOpt("force");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription(bundle.getString("arg.force"));
options.addOption(OptionBuilder.create('f'));
// create database
OptionBuilder.withLongOpt("database");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription(bundle.getString("arg.create-data-base"));
options.addOption(OptionBuilder.create('d'));
// export script
OptionBuilder.withLongOpt("script");
OptionBuilder.hasOptionalArg();
OptionBuilder.withArgName("file");
OptionBuilder.withDescription(bundle.getString("arg.export-script"));
options.addOption(OptionBuilder.create('s'));
// create basic data
OptionBuilder.withLongOpt("basic-data");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription(bundle.getString("arg.create-basic-data"));
options.addOption(OptionBuilder.create('b'));
// create initial data
OptionBuilder.withLongOpt("initial-data");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription(bundle.getString("arg.create-initial-data"));
options.addOption(OptionBuilder.create('i'));
// create sms data
OptionBuilder.withLongOpt("sms-data");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription(bundle.getString("arg.create-sms-data"));
options.addOption(OptionBuilder.create('m'));
return options;
}