当前位置: 首页>>代码示例>>Java>>正文


Java Options.addOption方法代码示例

本文整理汇总了Java中org.apache.commons.cli.Options.addOption方法的典型用法代码示例。如果您正苦于以下问题:Java Options.addOption方法的具体用法?Java Options.addOption怎么用?Java Options.addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.cli.Options的用法示例。


在下文中一共展示了Options.addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildCommandlineOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("g", "groupName", true, "consumer group name");
    opt.setRequired(false);
    options.addOption(opt);

    return options;
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:9,代码来源:ConsumerProgressSubCommand.java

示例2: createOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
/**
 * Create the CLI Options
 * 
 * @return the CLI Options
 * @throws IllegalArgumentException
 */
private static Options createOptions() throws IllegalArgumentException {
	Options options = new Options();

	// add an option
	options.addOption("help", false, "print this message");

	options.addOption("start", false, "start the SQL Web server");

	options.addOption("stop", false, "stop the SQL Web server");

	options.addOption("version", false, "print version");

	String propertiesOptionMesssage = getPropertiesOptionMessage();

	@SuppressWarnings("static-access")
	Option propertiesOption = OptionBuilder.withArgName("file").hasArg().withDescription(propertiesOptionMesssage)
			.create("properties");

	@SuppressWarnings("static-access")
	Option hostOption = OptionBuilder.withArgName("hostname").hasArg().withDescription("hostname of the Web server")
			.create("host");

	@SuppressWarnings("static-access")
	Option portOption = OptionBuilder.withArgName("port number").hasArg()
			.withDescription("port number of the Web server. Defaults to " + WebServerApi.DEFAULT_PORT)
			.create("port");

	options.addOption(propertiesOption);
	options.addOption(hostOption);
	options.addOption(portOption);

	return options;
}
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:40,代码来源:WebServer.java

示例3: getOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
private static Options getOptions() {
    Options options = new Options();
    //options.addOption("noui", false, "no UI, console only");
    options.addOption("h", "help", false, "print this message and exit");
    options.addOption("v", "version", false, "print the version information and exit");
    return options;
}
 
开发者ID:rjaros87,项目名称:pm-home-station,代码行数:8,代码来源:Start.java

示例4: configureCommandLineOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
private static Options configureCommandLineOptions() {
		Options result = new Options();

		result.addOption("i", "input", true, "specify the input directory from which to read Parquet data files");
		result.addOption("o", "output", true, "specify the output directory where to write the results file");
//		result.addOption(OptionBuilder.withLongOpt( "strategy" )
//				                      .withDescription( "specify the benchmark query to execute on the dataset" )
//                                      .hasArgs()
//                                      .withArgName("select")
//                                      .create('s') );
		result.addOption("n", "number", true, "specify the number of repetitions of a query test (10 by default)");
       
		return result;
	}
 
开发者ID:pfratta,项目名称:ParquetUtils,代码行数:15,代码来源:ParquetBench.java

示例5: getOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
private static Options getOptions() {
    final Options options = new Options();
    options.addOption("s", "scope", true, "The scope (namespace) of the Stream to write to.");
    options.addOption("n", "name", true, "The name of the Stream to write to.");
    options.addOption("u", "uri", true, "The URI to the Pravega controller in the form tcp://host:port");
    return options;
}
 
开发者ID:pravega,项目名称:pravega-samples,代码行数:8,代码来源:ConsoleWriter.java

示例6: getSharedOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@SuppressWarnings({ "static-access", "AccessStaticViaInstance" })
protected void getSharedOptions(Options options) {
    options.addOption(OptionBuilder.withArgName("results_path").hasArg()
            .withDescription("Directory in which to store the exported results lists.  If omitted, defaults to the current directory.")
            .withLongOpt(EXPORT_RESULTS_PATH).create());
    options.addOption(OptionBuilder.withArgName("string").hasArg()
            .withDescription("Prefix for the results lists file names.  If omitted, results lists file names have no prefix.")
            .withLongOpt(EXPORT_RESULTS_PREFIX).create());

    options.addOption(OptionBuilder.withArgName("integer").hasArg()
            .withDescription("Maximum number of connections per HCP system node.  Valid range is from 1 to 100.  If omitted, defaults to 25.")
            .withLongOpt(MAX_NODE_CONNECTIONS).create());
    options.addOption(OptionBuilder.withArgName("integer").hasArg()
            .withDescription("Maximum number of connections to the HCP system.  Valid range is from 2 to 1000.  If omitted, defaults to 200")
            .withLongOpt(MAX_CONNECTIONS).create());
    options.addOption(OptionBuilder.withArgName("integer").hasArg()
            .withDescription("Maximum number of connections per HCP system node during reduced load.  Valid range is from 1 to 100.  If omitted, defaults to 4.")
            .withLongOpt(REDUCED_MAX_NODE_CONNECTIONS).create());
    options.addOption(OptionBuilder.withArgName("integer").hasArg()
            .withDescription("Maximum number of connections to the HCP system during reduced load.  Valid range is from 2 to 1000.  If omitted, defaults to 50.")
            .withLongOpt(REDUCED_MAX_CONNECTIONS).create());
    options.addOption(OptionBuilder.withArgName("hh:mm").hasArg()
            .withDescription("Start time for the reduced load.  If omitted, defaults to 08:00.  If "
                    + REDUCED_END + " is also omitted, reduced load is off.")
            .withLongOpt(REDUCED_START).create());
    options.addOption(OptionBuilder.withArgName("hh:mm").hasArg()
            .withDescription("End time for the reduced load.  If omitted, defaults to 20:00.  If "
                    + REDUCED_START + " is also omitted, reduced load is off.")
            .withLongOpt(REDUCED_END).create());

    options.addOption(OptionBuilder.withArgName("job_name").hasArg()
            .withDescription("The name of the job.")
            .withLongOpt(JOB_NAME).create());

    options.addOption(getInsecureSSLOption());

}
 
开发者ID:Hitachi-Data-Systems,项目名称:Open-DM,代码行数:38,代码来源:ManagedCLIJob.java

示例7: buildCommandlineOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
public Options buildCommandlineOptions(Options options) {
    Option opt = new Option("b", "brokerName", true, "broker name");
    opt.setRequired(true);
    options.addOption(opt);
    return options;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:8,代码来源:WipeWritePermSubCommand.java

示例8: getOptions

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
public Options getOptions() {
    Options options = new Options();
    options.addOption(Option.builder()
            .longOpt(FILE)
            .desc("the script file")
            .hasArg()
            .required()
            .argName("FILE")
            .build());
    return options;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:13,代码来源:RunScriptTool.java

示例9: addStandardParameters

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
static Options addStandardParameters(Options options) {
    options.addOption(CMOptions.USER);
    options.addOption(CMOptions.PASSWORD);
    options.addOption(CMOptions.HOST);
    options.addOption(CMOptions.HELP);
    options.addOption(CMOptions.VERSION);
    return options;
}
 
开发者ID:SAP,项目名称:devops-cm-client,代码行数:9,代码来源:Commands.java

示例10: parseArgumentsInstall

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
private Map<String, Object> parseArgumentsInstall(final String... args) {
    if (args.length > 0) {
        try {

            Options options = new Options();
            options.addOption("pythonBinaryPath", true, "Python Binary Path");
            options.addOption("verbose", true, "Verbose Mode");
            options.addOption("classpath", true, "Additional JAVA classpath ?");
            options.addOption("javaBinaryPath", true, "Java Binary Path");

            CommandLineParser parser = new DefaultParser();
            CommandLine cmd = parser.parse(options, args);

            Map<String, Object> parameters = new HashMap<>();

            parameters.put("pythonBinaryPath", cmd.getOptionValue("pythonBinaryPath"));

            parameters.put("logLevel", cmd.getOptionValue("verbose"));

            if (cmd.getOptionValue("classpath") != null) {
                parameters.put("classpath", cmd.getOptionValue("classpath"));
            } else {
                parameters.put("classpath", null);
            }

            if (cmd.getOptionValue("javaBinaryPath") != null) {
                parameters.put("javaBinaryPath", cmd.getOptionValue("javaBinaryPath"));
            } else {
                parameters.put("javaBinaryPath", null);
            }

            return parameters;

        } catch (ParseException ex) {
            log.error("Error parsing arguments : " + ex.toString());
        }
    } else {
        log.error("No parameters passed to the Scijava kernel.");
    }
    return null;
}
 
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:42,代码来源:DefaultJupyterService.java

示例11: main

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
  CommandLineParser parser = new DefaultParser();

  // create the Options
  Options options = new Options();
  options.addOption(Option.builder("f")
      .required(true).hasArg()
      .longOpt("extra_action_file")
      .desc("bazel extra action protobuf file")
      .build());
  options.addOption(Option.builder("hc")
      .required(true).hasArg()
      .longOpt("twister2_checkstyle_config_file")
      .desc("checkstyle config file")
      .build());
  options.addOption(Option.builder("ac")
      .required(true).hasArg()
      .longOpt("apache_checkstyle_config_file")
      .desc("checkstyle config file for imported source files")
      .build());

  try {
    // parse the command line arguments
    CommandLine line = parser.parse(options, args);

    String extraActionFile = line.getOptionValue("f");
    String configFile = line.getOptionValue("hc");
    String apacheConfigFile = line.getOptionValue("ac");

    // check twister2 source file style
    String[] twister2SourceFiles = getTwister2SourceFiles(extraActionFile);
    checkStyle(twister2SourceFiles, configFile);

    // check other apache source file style
    String[] apacheSourceFiles = getApacheSourceFiles(extraActionFile);
    checkStyle(apacheSourceFiles, apacheConfigFile);

  } catch (ParseException exp) {
    LOG.severe(String.format("Invalid input to %s: %s", CLASSNAME, exp.getMessage()));
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("java " + CLASSNAME, options);
  }
}
 
开发者ID:DSC-SPIDAL,项目名称:twister2,代码行数:44,代码来源:JavaCheckstyle.java

示例12: getCommand

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
public Command getCommand() {
    return new Command() {
        @Override
        public String getName() {
            return "export-tasks-statistics";
        }

        @Override
        public String getTheme() {
            return "MPI statistics";
        }

        @Override
        public String getDescription() {
            return "export tasks statistics to CSV";
        }

        @Override
        public Options getOptions() {
            Options options = new Options();
            options.addOption(Option.builder().longOpt(STATISTICS_DB_DIR)
                    .desc("statistics db directory")
                    .hasArg()
                    .argName("DIR")
                    .required()
                    .build());
            options.addOption(Option.builder().longOpt(STATISTICS_DB_NAME)
                    .desc("statistics db name")
                    .hasArg()
                    .argName("NAME")
                    .required()
                    .build());
            options.addOption(Option.builder().longOpt(OUTPUT_FILE)
                    .desc("CSV output file")
                    .hasArg()
                    .argName("FILE")
                    .required()
                    .build());
            return options;
        }

        @Override
        public String getUsageFooter() {
            return null;
        }
    };
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:49,代码来源:ExportTasksStatisticsTool.java

示例13: main

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	CommandLineParser parser = new GnuParser();
	Options options = new Options();

	options.addOption(OptionBuilder.withLongOpt("dump-entity-filter")
	        .withDescription("Dump feature file for entity filter").create("a"));
	options.addOption(OptionBuilder.withLongOpt("dump-annotation-regressor")
	        .withDescription("Dump feature file for annotation regressor").create("e"));
	options.addOption(OptionBuilder.withLongOpt("dump-collective-rank")
	        .withDescription("Dump feature file for collective ranker").create("c"));
	options.addOption(OptionBuilder.withLongOpt("dump-greedy")
	        .withDescription("Dump feature file for greedy annotator (first step only!)").create("g"));
	options.addOption(OptionBuilder.withLongOpt("websearch-piggyback").hasArg().withArgName("WEBSEARCH")
	        .withDescription("What web search engine to piggyback on. Can be either `bing' or `google'.").create("w"));
	options.addOption("exclude_s1", false, "Exclude entity source 1.");
	options.addOption("exclude_s2", false, "Exclude entity source 2.");
	options.addOption("exclude_s3", false, "Exclude entity source 3.");

	CommandLine line = parser.parse(options, args);

	boolean s1 = !line.hasOption("exclude_s1");
	boolean s2 = !line.hasOption("exclude_s2");
	boolean s3 = !line.hasOption("exclude_s3");

	SmaphBuilder.Websearch ws = SmaphBuilder.websearchFromString(line.getOptionValue("websearch-piggyback"));

	Locale.setDefault(Locale.US);
	SmaphConfig c = SmaphConfig.fromConfigFile("smaph-config.xml");
	SmaphBuilder.initialize(c.getWatGcubeToken());
	CachedWAT2Annotator.setCache("wat2.cache");
	WATRelatednessComputer.setGcubeToken(c.getWatGcubeToken());
	WATRelatednessComputer.setCache("relatedness_wat2.cache");
	wikiApi = new WikipediaInterfaceWAT.WikipediaInterfaceWATBuilder().gcubeToken(c.getWatGcubeToken()).cache().build();
	wikiToFreeb = WikipediaToFreebase.open(c.getDefaultWikipediaToFreebaseStorage());
	e2a = EntityToAnchors.fromDB(c.getDefaultEntityToAnchorsStorage());

	Map<String, QueryInformation> qiCache = new HashMap<>();
	if (line.hasOption("dump-entity-filter"))
		generateEFModel(ws, s1, s2, s3, c, qiCache);
	if (line.hasOption("dump-annotation-regressor"))
		generateAnnotationRegressorModel(ws, s1, s2, s3, c, qiCache);
	if (line.hasOption("dump-collective-rank"))
		generateCollectiveModel(ws, s1, s2, s3, c, qiCache);
	if (line.hasOption("dump-greedy"))
		generateGreedyModel(ws, s1, s2, s3, c, qiCache);

	CachedWAT2Annotator.flush();
	WATRelatednessComputer.flush();
}
 
开发者ID:marcocor,项目名称:smaph,代码行数:50,代码来源:GenerateProblemFiles.java

示例14: getCommand

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
public Command getCommand() {
    return new Command() {
        @Override
        public String getName() {
            return "loadflow";
        }

        @Override
        public String getTheme() {
            return "Computation";
        }

        @Override
        public String getDescription() {
            return "Run loadflow";
        }

        @Override
        public Options getOptions() {
            Options options = new Options();
            options.addOption(Option.builder().longOpt(CASE_FILE)
                    .desc("the case path")
                    .hasArg()
                    .argName("FILE")
                    .required()
                    .build());
            options.addOption(Option.builder().longOpt(OUTPUT_FILE)
                    .desc("loadflow results output path")
                    .hasArg()
                    .argName("FILE")
                    .build());
            options.addOption(Option.builder().longOpt(OUTPUT_FORMAT)
                    .desc("loadflow results output format " + Arrays.toString(Format.values()))
                    .hasArg()
                    .argName("FORMAT")
                    .build());
            options.addOption(Option.builder().longOpt(SKIP_POSTPROC)
                    .desc("skip network importer post processors (when configured)")
                    .build());
            options.addOption(Option.builder().longOpt(OUTPUT_CASE_FORMAT)
                    .desc("modified network output format " + Exporters.getFormats())
                    .hasArg()
                    .argName("CASEFORMAT")
                    .build());
            options.addOption(Option.builder().longOpt(OUTPUT_CASE_FILE)
                    .desc("modified network base name")
                    .hasArg()
                    .argName("FILE")
                    .build());
            return options;
        }

        @Override
        public String getUsageFooter() {
            return null;
        }
    };
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:60,代码来源:RunLoadFlowTool.java

示例15: getCommand

import org.apache.commons.cli.Options; //导入方法依赖的package包/类
@Override
public Command getCommand() {
    return new Command() {
        @Override
        public String getName() {
            return "security-analysis";
        }

        @Override
        public String getTheme() {
            return "Computation";
        }

        @Override
        public String getDescription() {
            return "Run security analysis";
        }

        @Override
        public Options getOptions() {
            Options options = new Options();
            options.addOption(Option.builder().longOpt(CASE_FILE_OPTION)
                .desc("the case path")
                .hasArg()
                .argName("FILE")
                .required()
                .build());
            options.addOption(Option.builder().longOpt(LIMIT_TYPES_OPTION)
                .desc("limit type filter (all if not set)")
                .hasArg()
                .argName("LIMIT-TYPES")
                .build());
            options.addOption(Option.builder().longOpt(OUTPUT_FILE_OPTION)
                .desc("the output path")
                .hasArg()
                .argName("FILE")
                .build());
            options.addOption(Option.builder().longOpt(OUTPUT_FORMAT_OPTION)
                .desc("the output format " + SecurityAnalysisResultExporters.getFormats())
                .hasArg()
                .argName("FORMAT")
                .build());
            options.addOption(Option.builder().longOpt(CONTINGENCIES_FILE_OPTION)
                .desc("the contingencies path")
                .hasArg()
                .argName("FILE")
                .build());
            return options;
        }

        @Override
        public String getUsageFooter() {
            return "Where LIMIT-TYPES is one of " + Arrays.toString(LimitViolationType.values());
        }
    };
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:57,代码来源:SecurityAnalysisTool.java


注:本文中的org.apache.commons.cli.Options.addOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。