本文整理了Java中net.sourceforge.argparse4j.inf.Argument.required()
方法的一些代码示例,展示了Argument.required()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Argument.required()
方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.Argument
类名称:Argument
方法名:required
[英]If true is given, this named argument must be specified in command line otherwise error will be issued.
The default value is false. This object is a positional argument, this property is ignored.
[中]若给定true,则必须在命令行中指定此命名参数,否则将发出错误。
默认值为false。此对象是位置参数,忽略此属性。
代码示例来源:origin: spotify/helios
public DeploymentGroupInspectCommand(final Subparser parser) {
super(parser);
parser.help("inspect a deployment group");
nameArg = parser.addArgument("name")
.required(true)
.help("Deployment group name");
}
代码示例来源:origin: spotify/helios
public DeploymentGroupStopCommand(final Subparser parser) {
super(parser);
parser.help("Stop a deployment-group or abort a rolling-update");
nameArg = parser.addArgument("name")
.required(true)
.help("Deployment group name");
}
代码示例来源:origin: spotify/helios
public DeploymentGroupRemoveCommand(final Subparser parser) {
super(parser);
parser.help("remove a deployment-group. Note that this does not undeploy jobs previously "
+ "deployed by the deployment-group");
nameArg = parser.addArgument("deployment-group-name")
.required(true)
.help("Deployment group name");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("--confirm-delete-everything")
.action(Arguments.storeTrue())
.required(true)
.help("indicate you understand this deletes everything in your database");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("tag-name")
.dest("tag-name")
.nargs(1)
.required(true)
.help("The tag name");
}
代码示例来源:origin: signalapp/Signal-Server
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-u", "--user")
.dest("user")
.type(String.class)
.required(true)
.help("The user to remove");
}
代码示例来源:origin: spotify/helios
public DeploymentGroupStatusCommand(final Subparser parser) {
super(parser);
parser.help("Show deployment-group status");
nameArg = parser.addArgument("name")
.required(true)
.help("Deployment group name");
fullArg = parser.addArgument("-f")
.action(storeTrue())
.help("Print full hostnames and job ids.");
}
代码示例来源:origin: spotify/helios
public DeploymentGroupCreateCommand(final Subparser parser) {
super(parser);
parser.help("create a deployment group");
nameArg = parser.addArgument("name")
.required(true)
.help("Deployment group name");
hostSelectorsArg = parser.addArgument("host_selectors")
.action(append())
.setDefault(Lists.newArrayList())
.nargs("+")
.help("Host selector expression. Hosts matching this expression will be part of the "
+ "deployment-group. Multiple conditions can be specified, separated by spaces (as "
+ "separate arguments). If multiple conditions are given, all must be fulfilled. "
+ "Operators supported are =, !=, in and notin. Example: foo=bar baz!=qux");
quietArg = parser.addArgument("-q")
.action(storeTrue())
.help("only print job id");
}
代码示例来源:origin: linkedin/kafka-monitor
.required(false)
.type(String.class)
.metavar("TOPIC")
.required(false)
.type(String.class)
.dest("producerId")
.required(true)
.type(String.class)
.metavar("HOST1:PORT1[,HOST2:PORT2[...]]")
.required(true)
.type(String.class)
.metavar("HOST:PORT")
.required(false)
.type(String.class)
.metavar("RECORD_SIZE")
.required(false)
.type(String.class)
.metavar("PRODUCER_CLASS_NAME")
.required(false)
.type(String.class)
.metavar("CONSUMER_CLASS_NAME")
.required(false)
代码示例来源:origin: atomix/atomix
.type(String.class)
.nargs("?")
.required(false)
.help("The local member identifier, used in intra-cluster communication.");
parser.addArgument("--address", "-a")
.metavar("HOST:PORT")
.nargs("?")
.required(false)
.help("The address for the local member. If no address is specified, the first public interface will be used.");
parser.addArgument("--host")
.type(String.class)
.nargs("?")
.required(false)
.help("The host on which this member runs, used for host-aware partition management.");
parser.addArgument("--rack")
.type(String.class)
.nargs("?")
.required(false)
.help("The rack on which this member runs, used for rack-aware partition management.");
parser.addArgument("--zone")
.type(String.class)
.nargs("?")
.required(false)
.help("The zone in which this member runs, used for zone-aware partition management.");
parser.addArgument("--config", "-c")
.type(File.class)
.nargs("*")
代码示例来源:origin: SeldonIO/seldon-server
public static void main(String[] args) throws Exception {
ArgumentParser parser = ArgumentParsers.newArgumentParser("ImpressionsToInfluxDb")
.defaultHelp(true)
.description("Read Seldon impressions and send stats to influx db");
parser.addArgument("-t", "--topic").setDefault("actions").help("Kafka topic to read from");
parser.addArgument("-c", "--client").required(true).help("Client to run item similarity");
parser.addArgument("-o", "--output-topic").required(true).help("Output topic");
parser.addArgument("-k", "--kafka").setDefault("localhost:9092").help("Kafka server and port");
parser.addArgument("-z", "--zookeeper").setDefault("localhost:2181").help("Zookeeper server and port");
parser.addArgument("-w", "--window-secs").type(Integer.class).setDefault(3600*5).help("streaming window size in secs, -1 means ignore");
parser.addArgument("-u", "--window-processed").type(Integer.class).setDefault(-1).help("streaming window size in processed count, -1 means ignore");
parser.addArgument("--output-poll-secs").type(Integer.class).setDefault(60).help("output timer polling period in secs");
parser.addArgument("--hashes").type(Integer.class).setDefault(100).help("number of hashes");
parser.addArgument("-m", "--min-activity").type(Integer.class).setDefault(200).help("min activity");
parser.addArgument("-p", "--parse-date-method").choices("json-time","json-utc","system").setDefault("json-time").help("min activity");
Namespace ns = null;
try {
ns = parser.parseArgs(args);
ItemSimilarityProcessor processor = new ItemSimilarityProcessor(ns);
processor.process(ns);
} catch (ArgumentParserException e) {
parser.handleError(e);
System.exit(1);
}
}
代码示例来源:origin: AsamK/signal-cli
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.addArgument("-g", "--group")
.required(true)
.help("Specify the recipient group ID.");
}
代码示例来源:origin: AsamK/signal-cli
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.addArgument("--uri")
.required(true)
.help("Specify the uri contained in the QR code shown by the new device.");
}
代码示例来源:origin: spotify/helios
.required(true)
.help("Deployment group name");
代码示例来源:origin: AsamK/signal-cli
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.addArgument("-d", "--deviceId")
.type(int.class)
.required(true)
.help("Specify the device you want to remove. Use listDevices to see the deviceIds.");
}
代码示例来源:origin: lenskit/lenskit
@Override
public void configureArguments(ArgumentParser parser) {
ScriptEnvironment.configureArguments(parser);
parser.addArgument("config_file")
.metavar("CONFIG")
.help("Load train-test configuration from CONFIG")
.type(File.class)
.required(true);
}
代码示例来源:origin: AsamK/signal-cli
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.addArgument("number")
.help("Specify the phone number, for which to set the trust.")
.required(true);
MutuallyExclusiveGroup mutTrust = subparser.addMutuallyExclusiveGroup();
mutTrust.addArgument("-a", "--trust-all-known-keys")
.help("Trust all known keys of this user, only use this for testing.")
.action(Arguments.storeTrue());
mutTrust.addArgument("-v", "--verified-fingerprint")
.help("Specify the fingerprint of the key, only use this option if you have verified the fingerprint.");
}
代码示例来源:origin: bazaarvoice/jolt
/**
* Initialize the arg parser for the Sort sub command
*
* @param subparsers The Subparsers object to attach the new Subparser to
*/
@Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser sortParser = subparsers.addParser( "sort" )
.description( "Jolt CLI Sort Tool. This tool will ingest one JSON input (from a file or standard input) and " +
"perform the Jolt sort operation on it. The sort order is standard alphabetical ascending, with a " +
"special case for \"~\" prefixed keys to be bumped to the top. The program will return an exit code " +
"of 0 if the sort operation is performed successfully or a 1 if an error is encountered." )
.defaultHelp( true );
sortParser.addArgument( "input" ).help( "File path to the input JSON that the sort operation should be performed on. " +
"This file should contain valid JSON. " +
"If this argument is not specified then standard input will be used." )
.type( Arguments.fileType().verifyExists().verifyIsFile().verifyCanRead() )
.nargs( "?" ).setDefault( (File) null ).required( false ); // these last two method calls make input optional
sortParser.addArgument( "-u" ).help( "Turns off pretty print for the output. Output will be raw json with no formatting." )
.action( Arguments.storeTrue() );
}
代码示例来源:origin: graphhopper/map-matching
@Override
public void configure(Subparser subparser) {
subparser.addArgument("datasource")
.type(String.class)
.required(true);
subparser.addArgument("--vehicle")
.type(String.class)
.required(false)
.setDefault("car");
}
代码示例来源:origin: graphhopper/map-matching
@Override
public void configure(Subparser subparser) {
subparser.addArgument("gpx")
.type(File.class)
.required(true)
.nargs("+")
.help("GPX file");
}
内容来源于网络,如有侵权,请联系作者删除!