本文整理汇总了Java中org.apache.commons.cli.OptionBuilder.isRequired方法的典型用法代码示例。如果您正苦于以下问题:Java OptionBuilder.isRequired方法的具体用法?Java OptionBuilder.isRequired怎么用?Java OptionBuilder.isRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.cli.OptionBuilder
的用法示例。
在下文中一共展示了OptionBuilder.isRequired方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initArgOption
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
private static void initArgOption(boolean required, String optionName, String optionArg) {
OptionBuilder.withArgName(optionName);
OptionBuilder.isRequired(required);
OptionBuilder.hasArg();
Option opt = OptionBuilder.create(optionArg);
OPTIONS.addOption(opt);
}
示例5: createCommandLineOptions
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Creates the command line options.
*
* @return the {@link Options}
*/
private static Options createCommandLineOptions() {
Options options = new Options();
OptionBuilder.withArgName("help");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription("print this message");
OptionBuilder.isRequired(false);
options.addOption(OptionBuilder.create("help"));
OptionBuilder.withArgName("file");
OptionBuilder.hasArg(true);
OptionBuilder.withDescription("aw-report-alerting-sample.properties file.");
OptionBuilder.isRequired(false);
options.addOption(OptionBuilder.create("file"));
OptionBuilder.withArgName("accountIdsFile");
OptionBuilder.hasArg(true);
OptionBuilder.withDescription(
"Consider ONLY the account IDs specified on the file to run the report");
OptionBuilder.isRequired(false);
options.addOption(OptionBuilder.create("accountIdsFile"));
OptionBuilder.withArgName("debug");
OptionBuilder.hasArg(false);
OptionBuilder.withDescription("Will display all the debug information. "
+ "If the option 'verbose' is activated, "
+ "all the information will be displayed on the console as well");
OptionBuilder.isRequired(false);
options.addOption(OptionBuilder.create("debug"));
return options;
}
示例6: 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"));
}
示例7: parseArgs
import org.apache.commons.cli.OptionBuilder; //导入方法依赖的package包/类
/**
* Method to parse specific arguments for "Upload".
*
* @throws AdeException
*
*/
protected final void parseArgs(String[] args) throws AdeException {
final Options options = new Options();
OptionBuilder.withArgName(OPTION_DUMP_PARSE_REPORT);
OptionBuilder.isRequired(false);
OptionBuilder.withDescription("Specify this option to generate parse report");
options.addOption(OptionBuilder.create(OPTION_DUMP_PARSE_REPORT));
final CommandLine line = super.parseArgs(options, args);
if (line.hasOption(OPTION_DUMP_PARSE_REPORT)) {
getAdeExtProperties().setParseReportRequested(true);
}
}
示例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;
}