本文整理了Java中net.sourceforge.argparse4j.inf.Argument.action()
方法的一些代码示例,展示了Argument.action()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Argument.action()
方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.Argument
类名称:Argument
方法名:action
[英]Sets the action to be taken when this argument is encountered at the command line.
[中]设置在命令行遇到此参数时要采取的操作。
代码示例来源:origin: dropwizard/dropwizard
private void addHelp(ArgumentParser p) {
p.addArgument("-h", "--help")
.action(new SafeHelpAction(stdOut))
.help("show this help message and exit")
.setDefault(Arguments.SUPPRESS);
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-v", "--verbose")
.action(Arguments.storeTrue())
.dest("verbose")
.help("Output verbose information");
subparser.addArgument("-i", "--include")
.action(Arguments.append())
.dest("contexts")
.help("include change sets from the given context");
}
代码示例来源: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("-i", "--include")
.action(Arguments.append())
.dest("contexts")
.help("include change sets from the given context");
}
代码示例来源:origin: spotify/helios
public MasterListCommand(Subparser parser) {
super(parser);
parser.help("list masters");
fullArg = parser.addArgument("-f")
.action(storeTrue())
.help("Print full hostnames");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-l", "--list")
.dest("list")
.action(Arguments.storeTrue())
.setDefault(Boolean.FALSE)
.help("list all open locks");
subparser.addArgument("-r", "--force-release")
.dest("release")
.action(Arguments.storeTrue())
.setDefault(Boolean.FALSE)
.help("forcibly release all open locks");
}
代码示例来源:origin: signalapp/Signal-Server
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-v", "--verbose")
.action(Arguments.storeTrue())
.dest("verbose")
.help("Output verbose information");
subparser.addArgument("-i", "--include")
.action(Arguments.append())
.dest("contexts")
.help("include change sets from the given context");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-n", "--dry-run")
.action(Arguments.storeTrue())
.dest("dry-run")
.setDefault(Boolean.FALSE)
.help("output the DDL to stdout, don't run it");
subparser.addArgument("-a", "--all")
.action(Arguments.storeTrue())
.dest("all")
.setDefault(Boolean.FALSE)
.help("mark all pending change sets as applied");
subparser.addArgument("-i", "--include")
.action(Arguments.append())
.dest("contexts")
.help("include change sets from the given context");
}
代码示例来源:origin: dropwizard/dropwizard
private ArgumentParser buildParser(JarLocation location) {
final String usage = "java -jar " + location;
final ArgumentParser p = ArgumentParsers.newFor(usage).addHelp(false).build();
p.version(location.getVersion().orElse(
"No application version detected. Add a Implementation-Version " +
"entry to your JAR's manifest to enable this."));
addHelp(p);
p.addArgument("-v", "--version")
.action(Arguments.help()) // never gets called; intercepted in #run
.help("show the application version and exit");
return p;
}
代码示例来源:origin: spotify/helios
public JobListCommand(final Subparser parser) {
super(parser);
parser.help("list jobs");
patternArg = parser.addArgument("pattern")
.nargs("?")
.help("Job reference to filter on");
fullArg = parser.addArgument("-f")
.action(storeTrue())
.help("Print full job id's.");
quietArg = parser.addArgument("-q")
.action(storeTrue())
.help("only print job id's");
deployedArg = parser.addArgument("-y")
.action(storeTrue())
.help("only show deployed jobs");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-i", "--include-default")
.action(Arguments.storeTrue())
.dest("include-default")
.help("Also render the template with the default name");
subparser.addArgument("names").nargs("*");
}
代码示例来源:origin: spotify/helios
public HostDeregisterCommand(Subparser parser) {
super(parser);
parser.help("deregister a host");
hostArg = parser.addArgument("host")
.help("Host name to deregister.");
yesArg = parser.addArgument("--yes")
.action(Arguments.storeTrue())
.help("Automatically answer 'yes' to the interactive prompt.");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-n", "--dry-run")
.action(Arguments.storeTrue())
.dest("dry-run")
.setDefault(Boolean.FALSE)
.help("output the DDL to stdout, don't run it");
subparser.addArgument("-c", "--count")
.type(Integer.class)
.dest("count")
.help("only apply the next N change sets");
subparser.addArgument("-i", "--include")
.action(Arguments.append())
.dest("contexts")
.help("include change sets from the given context");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-c", "--count")
.dest("count")
.type(Integer.class)
.help("limit script to the specified number of pending change sets");
subparser.addArgument("-i", "--include")
.action(Arguments.append())
.dest("contexts")
.help("include change sets from the given context");
}
代码示例来源: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 JobRemoveCommand(Subparser parser) {
super(parser);
parser.help("remove a job");
tokenArg = parser.addArgument("--token")
.nargs("?")
.setDefault("")
.help("Insecure access token");
yesArg = parser.addArgument("--yes")
.action(Arguments.storeTrue())
.help("Automatically answer 'yes' to the interactive prompt.");
}
代码示例来源:origin: spotify/helios
public JobStatusCommand(final Subparser parser) {
super(parser);
parser.help("show job or host status");
jobArg = parser.addArgument("-j", "--job")
.help("Job filter");
hostArg = parser.addArgument("--host")
.setDefault("")
.help("Host pattern");
fullArg = parser.addArgument("-f")
.action(storeTrue())
.help("Print full hostnames, job and container id's.");
}
代码示例来源:origin: spotify/helios
public DeploymentGroupWatchCommand(Subparser parser) {
super(parser);
parser.help("watch deployment groups");
nameArg = parser.addArgument("name")
.help("Deployment group name");
fullArg = parser.addArgument("-f")
.action(storeTrue())
.help("Print full hostnames and job ids.");
intervalArg = parser.addArgument("--interval")
.type(Integer.class)
.setDefault(1)
.help("polling interval, default 1 second");
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-n", "--dry-run")
.action(Arguments.storeTrue())
.dest("dry-run")
.setDefault(Boolean.FALSE)
.help("Output the DDL to stdout, don't run it");
subparser.addArgument("-t", "--tag").dest("tag").help("Rollback to the given tag");
subparser.addArgument("-d", "--date")
.dest("date")
.type(Date.class)
.help("Rollback to the given date");
subparser.addArgument("-c", "--count")
.dest("count")
.type(Integer.class)
.help("Rollback the specified number of change sets");
subparser.addArgument("-i", "--include")
.action(Arguments.append())
.dest("contexts")
.help("include change sets from the given context");
}
代码示例来源:origin: spotify/helios
public JobWatchCommand(Subparser parser) {
super(parser);
parser.help("watch jobs");
jobsArg = parser.addArgument("job")
.help("Job reference");
intervalArg = parser.addArgument("--interval")
.type(Integer.class)
.setDefault(1)
.help("polling interval, default 1 second");
prefixesArg = parser.addArgument("hosts")
.nargs("*")
.help("The hostname prefixes to watch the job on.");
exactArg = parser.addArgument("--exact")
.action(storeTrue())
.help("Show status of job for every host in hosts");
}
内容来源于网络,如有侵权,请联系作者删除!