• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MutuallyExclusiveGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.sourceforge.argparse4j.inf.MutuallyExclusiveGroup的典型用法代码示例。如果您正苦于以下问题:Java MutuallyExclusiveGroup类的具体用法?Java MutuallyExclusiveGroup怎么用?Java MutuallyExclusiveGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MutuallyExclusiveGroup类属于net.sourceforge.argparse4j.inf包,在下文中一共展示了MutuallyExclusiveGroup类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configureArgsParser

import net.sourceforge.argparse4j.inf.MutuallyExclusiveGroup; //导入依赖的package包/类
public static void configureArgsParser(final Subparsers subparsers) {
    final Subparser eval = subparsers.addParser("eval").help("evaluates namespace, experiment, or code snippet");
    Planout4jTool.addBackendArgs(eval, false);
    final MutuallyExclusiveGroup nameOrScript = eval.addMutuallyExclusiveGroup("evaluation object");
    nameOrScript.addArgument("-n", "--name").help("namespace name");
    final MutuallyExclusiveGroup experimentOrDefinition = eval.addMutuallyExclusiveGroup("additional selectors within namespace");
    experimentOrDefinition.addArgument("--exp").help("experiment name (requires --name NAME)");
    experimentOrDefinition.addArgument("--definition").help("experiment definition key (requires --name NAME)");
    experimentOrDefinition.addArgument("--default").action(Arguments.storeTrue()).help("default experiment (requires --name NAME)");
    nameOrScript.addArgument("--script").help("planout DSL script");
    eval.addArgument("input").nargs("+").help("input parameters in the form of KEY=VALUE");
}
 
开发者ID:Glassdoor,项目名称:planout4j,代码行数:13,代码来源:EvalTool.java


示例2: argParser

import net.sourceforge.argparse4j.inf.MutuallyExclusiveGroup; //导入依赖的package包/类
/**
 * Creates and returns the ArgumentParser object for parsing command line
 * arguments.
 *
 * @return the ArgumentParser object consisting of command line args.
 */
private static ArgumentParser argParser() {
	ArgumentParser parser = ArgumentParsers.newArgumentParser("KafkaBalancer").defaultHelp(true)
			.description("This tool is used to re-balance the kafka cluster.");

	parser.addArgument("--topic").action(store()).type(String.class).metavar("TOPIC").dest(TOPIC)
			.help("Topic on which the operation is to be performed.");

	parser.addArgument("--zookeeper").action(store()).required(true).type(String.class).dest(ZOOKEEPER)
			.help("zookeeper server URL.");

	MutuallyExclusiveGroup task = parser
			.addMutuallyExclusiveGroup()
			.required(true)
			.description(
					"--balance-partitions or --balance-leaders or --balance-followers or --reassign-under-replicated-partitions or --set-replication-factor must be specified");

	task.addArgument("--balance-partitions").setConst(BALANCE_PARTITIONS).action(storeConst()).dest(TASK)
			.required(false).type(String.class)
			.help("Rebalance cluster when there are no under-replicated partitions.");

	task.addArgument("--balance-leaders").setConst(BALANCE_LEADERS).action(storeConst()).dest(TASK).required(false)
			.type(String.class).help("Rebalance cluster but balance only leaders. Followers should be untouched");

	task.addArgument("--balance-followers").setConst(BALANCE_FOLLOWERS).action(storeConst()).dest(TASK)
			.required(false).type(String.class)
			.help("Rebalance cluster but balance only followers. Leaders should be untouched");

	task.addArgument("--reassign-under-replicated-partitions").setConst(REASSIGN_UNDER_REPLICATED_PARTITIONS)
			.action(storeConst()).dest(TASK).required(false).type(String.class)
			.help("Reassign under replicated partitions to online nodes.");

	task.addArgument("--set-replication-factor").action(store()).dest(SET_REPLICATION_FACTOR).required(false)
			.type(Integer.class).help("Set the number of replicas for a topic").setDefault(-1);

	MutuallyExclusiveGroup operation = parser.addMutuallyExclusiveGroup().required(true)
			.description("either --generate or --execute must be specified but not both.");

	operation.addArgument("--generate").setConst(GENERATE).action(storeConst()).dest(OPERATION).required(false)
			.type(String.class).help("Generate plan.");

	operation.addArgument("--execute").setConst(EXECUTE).action(storeConst()).dest(OPERATION).required(false)
			.type(String.class).help("Generate and execute plan.");

	parser.addArgument("--rack-aware").setConst(true).action(storeConst()).type(boolean.class).setDefault(false)
			.required(false).dest(RACK_AWARE).help("Consider racks while generating reassignment plan.");

	return parser;
}
 
开发者ID:flipkart-incubator,项目名称:kafka-balancer,代码行数:55,代码来源:KafkaBalancerMain.java


示例3: setupParser

import net.sourceforge.argparse4j.inf.MutuallyExclusiveGroup; //导入依赖的package包/类
private static ArgumentParser setupParser()
{
    ArgumentParser parser = ArgumentParsers.newArgumentParser( "cypher-shell" ).defaultHelp( true ).description(
            format( "A command line shell where you can execute Cypher against an instance of Neo4j. " +
                    "By default the shell is interactive but you can use it for scripting by passing cypher " +
                    "directly on the command line or by piping a file with cypher statements (requires Powershell on Windows)." +
                    "%n%n" +
                    "example of piping a file:%n" +
                    "  cat some-cypher.txt | cypher-shell" ) );

    ArgumentGroup connGroup = parser.addArgumentGroup("connection arguments");
    connGroup.addArgument("-a", "--address")
            .help("address and port to connect to")
            .setDefault("bolt://localhost:7687");
    connGroup.addArgument("-u", "--username")
            .setDefault("")
            .help("username to connect as. Can also be specified using environment variable NEO4J_USERNAME");
    connGroup.addArgument("-p", "--password")
            .setDefault("")
            .help("password to connect with. Can also be specified using environment variable NEO4J_PASSWORD");
    connGroup.addArgument("--encryption")
            .help("whether the connection to Neo4j should be encrypted; must be consistent with Neo4j's " +
                    "configuration")
            .type(new BooleanArgumentType())
            .setDefault(true);

    MutuallyExclusiveGroup failGroup = parser.addMutuallyExclusiveGroup();
    failGroup.addArgument("--fail-fast")
            .help("exit and report failure on first error when reading from file (this is the default behavior)")
            .dest("fail-behavior")
            .setConst(FAIL_FAST)
            .action(new StoreConstArgumentAction());
    failGroup.addArgument("--fail-at-end")
            .help("exit and report failures at end of input when reading from file")
            .dest("fail-behavior")
            .setConst(FAIL_AT_END)
            .action(new StoreConstArgumentAction());
    parser.setDefault("fail-behavior", FAIL_FAST);

    parser.addArgument("--format")
            .help("desired output format, verbose displays results in tabular format and prints statistics, " +
                    "plain displays data with minimal formatting")
            .choices(new CollectionArgumentChoice<>(
                    Format.AUTO.name().toLowerCase(),
                    Format.VERBOSE.name().toLowerCase(),
                    Format.PLAIN.name().toLowerCase()))
            .setDefault(Format.AUTO.name().toLowerCase());

    parser.addArgument("--debug")
            .help("print additional debug information")
            .action(new StoreTrueArgumentAction());

    parser.addArgument("--non-interactive")
            .help("force non-interactive mode, only useful if auto-detection fails (like on Windows)")
            .dest("force-non-interactive")
          .action(new StoreTrueArgumentAction());

    parser.addArgument("-v", "--version")
            .help("print version of cypher-shell and exit")
            .action(new StoreTrueArgumentAction());

    parser.addArgument("cypher")
            .nargs("?")
            .help("an optional string of cypher to execute and then exit");

    return parser;
}
 
开发者ID:neo4j,项目名称:cypher-shell,代码行数:68,代码来源:CliArgHelper.java


示例4: parse

import net.sourceforge.argparse4j.inf.MutuallyExclusiveGroup; //导入依赖的package包/类
private static Namespace parse(String[] args) {
	ArgumentParser parser = ArgumentParsers.newArgumentParser("lancoder")
			.defaultHelp(false)
			.version("${prog} " + LANCODER_VERSION);
	parser.addArgument("--version", "-V")
			.action(Arguments.version())
			.help("show the current version and exit");
	parser.addArgument("--verbose", "-v")
			.action(Arguments.count())
			.help("Increase verbosity. Default is level 3. '-vvvvvv' will be the most verbose,"
					+ " '-v' will be the less verbose.");

	MutuallyExclusiveGroup group = parser.addMutuallyExclusiveGroup()
			.required(true)
			.description("Run a master or worker instance");
	group.addArgument("--worker", "-w")
			.action(Arguments.storeTrue())
			.help("run the worker");
	group.addArgument("--master", "-m")
			.action(Arguments.storeTrue())
			.help("run the master");

	MutuallyExclusiveGroup group2 = parser.addMutuallyExclusiveGroup();
	group2.addArgument("--init-prompt", "-i")
			.action(Arguments.storeTrue())
			.help("intialize configuration and prompt user");
	group2.addArgument("--init-default", "-I")
			.action(Arguments.storeTrue())
			.help("initialize default config and exit");

	parser.addArgument("--debug", "-d")
			.action(Arguments.storeTrue())
			.help("Run lancoder in debug mode. Does not delete parts files after remuxing.");
	parser.addArgument("--config", "-c")
			.help("specify the config file");
	parser.addArgument("--overwrite", "-o")
			.action(Arguments.storeTrue())
			.help("if flag is set, overwrite old config");

	return parser.parseArgsOrFail(args);
}
 
开发者ID:jdupl,项目名称:lancoder,代码行数:42,代码来源:Main.java



注:本文中的net.sourceforge.argparse4j.inf.MutuallyExclusiveGroup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IllegalViewOperationException类代码示例发布时间:2022-05-22
下一篇:
Java LoggingCache类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap