本文整理了Java中net.sourceforge.argparse4j.inf.Argument.choices()
方法的一些代码示例,展示了Argument.choices()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Argument.choices()
方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.Argument
类名称:Argument
方法名:choices
[英]Sets a collection of the allowable values for the argument.
[中]设置参数的允许值的集合。
代码示例来源:origin: spotify/helios
.choices(statusChoices.toArray(new String[statusChoices.size()]))
.help("Filter hosts by its status. Valid statuses are: " + statusChoicesString);
代码示例来源:origin: atomix/atomix
.metavar("LEVEL")
.type(String.class)
.choices(logLevels)
.nargs("?")
.setDefault(System.getProperty("atomix.log.level", Level.DEBUG.toString()))
.metavar("LEVEL")
.type(String.class)
.choices(logLevels)
.nargs("?")
.setDefault(System.getProperty("atomix.log.file.level", Level.DEBUG.toString()))
.metavar("LEVEL")
.type(String.class)
.choices(logLevels)
.nargs("?")
.setDefault(System.getProperty("atomix.log.console.level", Level.INFO.toString()))
代码示例来源: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: io.github.jiri-meluzin/io.github.jiri-meluzin.tibcobwutils.earcomparer
public static void main(String[] args) {
ArgumentParser argParser = ArgumentParsers.newArgumentParser("EAR Version Extractor", true, "-")
.description("Extracts version from ear files in given directory.");
argParser.addArgument("-directory").type(String.class).required(true).help("Path to directory with ears");
argParser.addArgument("-out").choices("LIST", "FILES").required(true).help("Output type - LIST or FILES");
Namespace res = argParser.parseArgsOrFail(args);
String directory = res.get("directory");
String out = res.getString("out");
List<T.V2<Path, String>> output = new FileSearcher().searchFiles(Paths.get(directory), "glob:**/*.ear", false).
stream().parallel().
map(p -> getVersionFromEAR(p)).
collect(Collectors.toList());
if ("LIST".equals(out)) {
output.forEach(v -> System.out.println(v.getA().getFileName() + "\t" + v.getB()));
}
else {
output.forEach(v -> {
Path versionPath = Paths.get(v.getA().toString().replace(".ear", ".version"));
try(FileWriter ww = new FileWriter(versionPath.toFile()); BufferedWriter w = new BufferedWriter(ww)) {
w.write(v.getB());
} catch(IOException e) {
throw new RuntimeException("Could not write version to file: " + v.getA(), e);
}
});
}
}
代码示例来源:origin: SurveyMan/SurveyMan
private static ArgumentParser makeArgParser(){
ArgumentParser argumentParser = ArgumentParsers.newArgumentParser(
SurveyMan.class.getName(), true, "-").description(
"Performs static analysis and dynamic analysis on surveys according to the SurveyMan language.");
argumentParser.addArgument("survey").required(true);
for (Map.Entry<String, String> entry : ArgReader.getMandatoryAndDefault(SurveyMan.class).entrySet()) {
String arg = entry.getKey();
Argument a = argumentParser.addArgument("--" + arg)
.required(true)
.help(ArgReader.getDescription(arg));
String[] c = ArgReader.getChoices(arg);
if (c.length>0)
a.choices(c);
}
for (Map.Entry<String, String> entry : ArgReader.getOptionalAndDefault(SurveyMan.class).entrySet()) {
String arg = entry.getKey();
Argument a = argumentParser.addArgument("--" + arg)
.required(false)
.setDefault(entry.getValue())
.help(ArgReader.getDescription(arg));
String[] c = ArgReader.getChoices(arg);
if (c.length>0)
a.choices(c);
}
return argumentParser;
}
代码示例来源:origin: eus.ixa/ixa-pipe-nerc
/**
* Create the available parameters for Opinion Target Extraction.
*/
private void loadOteParameters() {
oteParser.addArgument("-m", "--model")
.required(true)
.help("Pass the model to do the tagging as a parameter.\n");
oteParser.addArgument("--clearFeatures")
.required(false)
.choices("yes", "no", "docstart")
.setDefault(Flags.DEFAULT_FEATURE_FLAG)
.help("Reset the adaptive features every sentence; defaults to 'no'; if -DOCSTART- marks" +
" are present, choose 'docstart'.\n");
oteParser.addArgument("-l","--language")
.required(false)
.choices("en")
.help("Choose language; it defaults to the language value in incoming NAF file.\n");
oteParser.addArgument("-o","--outputFormat")
.required(false)
.choices("naf", "opennlp")
.setDefault(Flags.DEFAULT_OUTPUT_FORMAT)
.help("Choose output format; it defaults to NAF.\n");
}
代码示例来源:origin: eus.ixa/ixa-pipe-pos
/**
* Load the evaluation parameters of the CLI.
*/
private void loadEvalParameters() {
this.evalParser.addArgument("-c","--component")
.required(true)
.choices("pos","lemma")
.help("Choose component for evaluation");
this.evalParser.addArgument("-m", "--model")
.required(true)
.help("Choose model");
this.evalParser.addArgument("-t", "--testSet")
.required(true)
.help("Input testset for evaluation");
this.evalParser.addArgument("--evalReport")
.required(false)
.choices("brief", "detailed", "error")
.help("Choose type of evaluation report; defaults to brief");
}
代码示例来源:origin: eus.ixa/ixa-pipe-nerc
annotateParser.addArgument("--clearFeatures")
.required(false)
.choices("yes", "no", "docstart")
.setDefault(Flags.DEFAULT_FEATURE_FLAG)
.help("Reset the adaptive features every sentence; defaults to 'no'; if -DOCSTART- marks" +
annotateParser.addArgument("-l","--language")
.required(false)
.choices("de", "en", "es", "eu", "it", "nl")
.help("Choose language; it defaults to the language value in incoming NAF file.\n");
annotateParser.addArgument("-o","--outputFormat")
.required(false)
.choices("conll03", "conll02", "naf", "opennlp")
.setDefault(Flags.DEFAULT_OUTPUT_FORMAT)
.help("Choose output format; it defaults to NAF.\n");
annotateParser.addArgument("--lexer")
.choices("numeric")
.setDefault(Flags.DEFAULT_LEXER)
.required(false)
annotateParser.addArgument("--dictTag")
.required(false)
.choices("tag", "post")
.setDefault(Flags.DEFAULT_DICT_OPTION)
.help("Choose to directly tag entities by dictionary look-up; if the 'tag' option is chosen, " +
代码示例来源:origin: eus.ixa/ixa-pipe-nerc
evalParser.addArgument("-l", "--language")
.required(true)
.choices("de", "en", "es", "eu", "it", "nl")
.help("Choose language.\n");
evalParser.addArgument("-m", "--model")
evalParser.addArgument("--clearFeatures")
.required(false)
.choices("yes", "no", "docstart")
.setDefault(Flags.DEFAULT_FEATURE_FLAG)
.help("Reset the adaptive features; defaults to 'no'.\n");
evalParser.addArgument("-f","--corpusFormat")
.required(false)
.choices("conll02", "conll03", "opennlp")
.setDefault(Flags.DEFAULT_EVAL_FORMAT)
.help("Choose format of reference corpus; it defaults to conll02 format.\n");
evalParser.addArgument("--evalReport")
.required(false)
.choices("brief", "detailed", "error")
.help("Choose level of detail of evaluation report; it defaults to detailed evaluation.\n");
evalParser.addArgument("--types")
代码示例来源:origin: io.github.jiri-meluzin/io.github.jiri-meluzin.tibcobwutils.earcomparer
public static void main(String[] args) {
ArgumentParser argParser = ArgumentParsers.newArgumentParser("Tibco passwords de/encryptor", true, "-")
.description("Encrypts or decrypts Tibco password from fullConfigs");
argParser.addArgument("-action").choices(ENCRYPT, DECRYPT).required(true).help("What to do - encrypt or decrypt. Ex: decrypt");
argParser.addArgument("-password").type(String.class).required(true).help("Password string to be encrypted or decrypted. Ex: #!St7Uzipt4y6Od6iTLGNtwSUiLk00LuMB");
Namespace res = argParser.parseArgsOrFail(args);
String action = res.getString("action");
String password = res.getString("password");
switch (action) {
case ENCRYPT: System.out.println(new PasswordDecrypter().encrypt(password));
break;
case DECRYPT: System.out.println(new PasswordDecrypter().decrypt(password));
break;
}
}
}
代码示例来源:origin: io.ifar.skid-road/skid-road-dropwizard
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
List<String> states = new ArrayList<>();
for (LogFileState state : LogFileState.values()) {
states.add(state.name());
}
subparser.addArgument("-s","--state")
.required(true)
.dest(STATE)
.choices(states)
.nargs("+")
.help("the state(s) of files to include");
subparser.addArgument("-i","--start-date")
.required(true)
.dest(START_DATE)
.help("a start date in ISO format (yyyy-MM-dd or yyyy-MM-ddThh:mm); only files with a start on or after this date will be included.");
subparser.addArgument("-e","--end-date")
.required(true)
.dest(END_DATE)
.help("an end date in ISO format (yyyy-MM-dd or yyyy-MM-ddThh:mm); only files with a start on or before this date will be included.");
subparser.addArgument("-o","--out")
.required(true)
.dest(OUT_FILE)
.help("the output file to write to (will be overwritten).");
}
代码示例来源:origin: CogComp/cogcomp-nlp
parser.addArgument("-m", "--model").help("The model output file").setDefault("out.model");
parser.addArgument("-p", "--pos").help("The type of PoS tags to use")
.choices("gold", "auto").setDefault("auto");
parser.addArgument("-o", "--offset").type(Integer.class)
.help("The offset of the pos/head/dep index for the CoNLL train/test files")
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-depparse
parser.addArgument("-m", "--model").help("The model output file").setDefault("out.model");
parser.addArgument("-p", "--pos").help("The type of PoS tags to use")
.choices("gold", "auto").setDefault("auto");
parser.addArgument("-o", "--offset").type(Integer.class)
.help("The offset of the pos/head/dep index for the CoNLL train/test files")
代码示例来源:origin: eus.ixa/ixa-pipe-pos
.help("It is required to provide a lemmatizer model.");
this.annotateParser.addArgument("-l", "--language")
.choices("de", "en", "es", "eu", "fr", "gl", "it", "nl")
.required(false)
.help("Choose a language.");
annotateParser.addArgument("-o", "--outputFormat")
.required(false)
.choices("naf", "conll")
.setDefault(Flags.DEFAULT_OUTPUT_FORMAT)
.help("Choose output format; it defaults to NAF.\n");
代码示例来源:origin: omkreddy/kafka-examples
.setDefault("byte")
.type(String.class)
.choices(Arrays.asList("byte", "kryo"))
.metavar("BYTE/KRYO")
.help("use byte array or kryo serializer");
代码示例来源:origin: eus.ixa/ixa-pipe-pos
.help("It is required to provide a lemmatizer model.");
serverParser.addArgument("-l", "--language")
.choices("de", "en", "es", "eu", "fr", "gl", "it", "nl")
.required(true)
.help("Choose a language to perform annotation with ixa-pipe-pos.");
.help("Choose beam size for decoding, it defaults to 3.");
serverParser.addArgument("-o", "--outputFormat").required(false)
.choices("naf", "conll")
.setDefault(Flags.DEFAULT_OUTPUT_FORMAT)
.help("Choose output format; it defaults to NAF.\n");
代码示例来源:origin: omkreddy/kafka-examples
.setDefault("earliest")
.type(String.class)
.choices("earliest", "latest")
.help("What to do when there is no initial offset in Kafka");
代码示例来源:origin: charite/jannovar
ArgumentGroup optionalGroup = subParser.addArgumentGroup("Additional CSV arguments (optional)");
optionalGroup.addArgument("-t", "--type").type(CSVFormat.Predefined.class)
.choices(CSVFormat.Predefined.Default, CSVFormat.Predefined.TDF, CSVFormat.Predefined.RFC4180,
CSVFormat.Predefined.Excel, CSVFormat.Predefined.MySQL)
.help("Type of csv file. ").setDefault(CSVFormat.Predefined.Default);
代码示例来源:origin: omkreddy/kafka-examples
.setDefault("earliest")
.type(String.class)
.choices("earliest", "latest")
.help("What to do when there is no initial offset in Kafka");
代码示例来源:origin: omkreddy/kafka-examples
.setDefault("earliest")
.type(String.class)
.choices("earliest", "latest")
.help("What to do when there is no initial offset in Kafka");
内容来源于网络,如有侵权,请联系作者删除!