本文整理汇总了Java中net.sourceforge.argparse4j.inf.Subparser.addArgumentGroup方法的典型用法代码示例。如果您正苦于以下问题:Java Subparser.addArgumentGroup方法的具体用法?Java Subparser.addArgumentGroup怎么用?Java Subparser.addArgumentGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.argparse4j.inf.Subparser
的用法示例。
在下文中一共展示了Subparser.addArgumentGroup方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupParser
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
/**
* Setup {@link ArgumentParser}
*
* @param subParsers
* {@link Subparsers} to setup
*/
public static void setupParser(Subparsers subParsers) {
BiFunction<String[], Namespace, DownloadCommand> handler = (argv, args) -> {
try {
return new DownloadCommand(argv, args);
} catch (CommandLineParsingException e) {
throw new UncheckedJannovarException("Could not parse command line", e);
}
};
Subparser subParser = subParsers.addParser("download", true).help("download transcript databases")
.setDefault("cmd", handler);
subParser.description("Download transcript database");
ArgumentGroup requiredGroup = subParser.addArgumentGroup("Required arguments");
requiredGroup.addArgument("-d", "--database").help("Name of database to download, can be given multiple times")
.setDefault(new ArrayList<String>()).action(Arguments.append()).required(true);
ArgumentGroup optionalGroup = subParser.addArgumentGroup("Optional Arguments");
optionalGroup.addArgument("-s", "--data-source-list").help("INI file with data source list")
.setDefault(Lists.newArrayList("bundle:///default_sources.ini")).action(Arguments.append());
optionalGroup.addArgument("--download-dir").help("Path to download directory").setDefault("data");
JannovarBaseOptions.setupParser(subParser);
}
示例2: setupParser
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
/**
* Setup {@link ArgumentParser}
*
* @param subParsers
* {@link Subparsers} to setup
*/
public static void setupParser(Subparsers subParsers) {
BiFunction<String[], Namespace, DatabaseListCommand> handler = (argv, args) -> {
try {
return new DatabaseListCommand(argv, args);
} catch (CommandLineParsingException e) {
throw new UncheckedJannovarException("Could not parse command line", e);
}
};
Subparser subParser = subParsers.addParser("db-list", true).help("list databases available for download")
.setDefault("cmd", handler);
subParser.description("List databases available for download");
ArgumentGroup optionalGroup = subParser.addArgumentGroup("Optional Arguments");
optionalGroup.addArgument("-s", "--data-source-list").help("INI file with data source list")
.setDefault(Lists.newArrayList("bundle:///default_sources.ini")).action(Arguments.append());
JannovarBaseOptions.setupParser(subParser);
}
示例3: setupParser
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
/**
* Setup {@link ArgumentParser}
*
* @param subParsers
* {@link Subparsers} to setup
*/
public static void setupParser(Subparsers subParsers) {
BiFunction<String[], Namespace, AnnotatePositionCommand> handler = (argv, args) -> {
try {
return new AnnotatePositionCommand(argv, args);
} catch (CommandLineParsingException e) {
throw new UncheckedJannovarException("Could not parse command line", e);
}
};
Subparser subParser = subParsers.addParser("annotate-pos", true)
.help("annotate genomic changes given on the command line").setDefault("cmd", handler);
subParser.description("Perform annotation of genomic changes given on the command line");
ArgumentGroup requiredGroup = subParser.addArgumentGroup("Required arguments");
requiredGroup.addArgument("-d", "--database").help("Path to database .ser file").required(true);
requiredGroup.addArgument("-c", "--genomic-change").help("Genomic change to annotate, you can give multiple ones")
.action(Arguments.append()).required(true);
subParser.epilog("Example: java -jar Jannovar.jar annotate-pos -d hg19_refseq.ser -c 'chr1:12345C>A'");
JannovarAnnotationOptions.setupParser(subParser);
}
示例4: setupParser
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
/**
* Setup {@link ArgumentParser}
*
* @param subParsers
* {@link Subparsers} to setup
*/
public static void setupParser(Subparsers subParsers) {
BiFunction<String[], Namespace, GatherStatisticsCommand> handler = (argv, args) -> {
try {
return new GatherStatisticsCommand(argv, args);
} catch (CommandLineParsingException e) {
throw new UncheckedJannovarException("Could not parse command line", e);
}
};
Subparser subParser = subParsers.addParser("statistics", true).help("compute statistics about VCF file")
.setDefault("cmd", handler);
subParser.description("Compute statistics about variants in VCF file");
ArgumentGroup requiredGroup = subParser.addArgumentGroup("Required arguments");
requiredGroup.addArgument("-i", "--input-vcf").help("Path to input VCF file").required(true);
requiredGroup.addArgument("-o", "--output-report").help("Path to output report TXT file").required(true);
requiredGroup.addArgument("-d", "--database").help("Path to database .ser file").required(true);
JannovarBaseOptions.setupParser(subParser);
}
示例5: setupParser
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
/**
* Setup {@link ArgumentParser}
*
* @param subParsers
* {@link Subparsers} to setup
*/
public static void setupParser(Subparsers subParsers) {
BiFunction<String[], Namespace, ProjectTranscriptToChromosome> handler = (argv, args) -> {
try {
return new ProjectTranscriptToChromosome(args);
} catch (CommandLineParsingException e) {
throw new UncheckedJannovarException("Could not parse command line", e);
}
};
Subparser subParser = subParsers.addParser("hgvs-to-vcf", true)
.help("project transcript-level to chromosome-level changes").setDefault("cmd", handler);
subParser.description("Project transcript-level changes to chromosome level ones");
ArgumentGroup requiredGroup = subParser.addArgumentGroup("Required arguments");
requiredGroup.addArgument("-r", "--reference-fasta").help("Path to reference FASTA file").required(true);
requiredGroup.addArgument("-d", "--database").help("Path to database .ser file").required(true);
requiredGroup.addArgument("-i", "--input-txt").help("Input file with HGVS transcript-level changes, line-by-line")
.required(true);
requiredGroup.addArgument("-o", "--output-vcf").help("Output VCF file with chromosome-level changes")
.required(true);
ArgumentGroup optionalGroup = subParser.addArgumentGroup("Optional Arguments");
optionalGroup.addArgument("--show-all").help("Show all effects").setDefault(false);
optionalGroup.addArgument("--no-3-prime-shifting").help("Disable shifting towards 3' of transcript")
.dest("3_prime_shifting").setDefault(true).action(Arguments.storeFalse());
optionalGroup.addArgument("--3-letter-amino-acids").help("Enable usage of 3 letter amino acid codes")
.setDefault(false).action(Arguments.storeTrue());
subParser.epilog("Example: java -jar Jannovar.jar tx-to-chrom -i in.txt -o out.vcf");
JannovarBaseOptions.setupParser(subParser);
}
示例6: setupParser
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
/**
* Setup {@link ArgumentParser}
*
* @param subParsers
* {@link Subparsers} to setup
*/
public static void setupParser(Subparsers subParsers) {
BiFunction<String[], Namespace, AnnotateCSVCommand> handler = (argv, args) -> {
try {
return new AnnotateCSVCommand(args);
} catch (CommandLineParsingException e) {
throw new UncheckedJannovarException("Could not parse command line", e);
}
};
Subparser subParser = subParsers.addParser("annotate-csv", true).help("Annotate a csv file").setDefault("cmd",
handler);
subParser.description("Perform annotation of genomic changes given on the command line");
ArgumentGroup requiredGroup = subParser.addArgumentGroup("Required arguments");
requiredGroup.addArgument("-d", "--database").help("Path to database .ser file").required(true);
requiredGroup.addArgument("-i", "--input").help("CSV file").required(true);
requiredGroup.addArgument("-c", "--chr").type(Integer.class).help("Column of chr (1 based)").required(true);
requiredGroup.addArgument("-p", "--pos").type(Integer.class).help("Column of pos (1 based)").required(true);
requiredGroup.addArgument("-r", "--ref").type(Integer.class).help("Column of ref (1 based)").required(true);
requiredGroup.addArgument("-a", "--alt").type(Integer.class).help("Column of alt (1 based)").required(true);
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);
optionalGroup.addArgument("--header").help("Set if the file contains a header. ").setDefault(false)
.action(Arguments.storeTrue());
subParser.epilog(
"Example: java -jar Jannovar.jar annotate-csv -d hg19_refseq.ser -c 1 -p 2 -r 3 -r 4 -t TDF --header -i input.csv");
JannovarAnnotationOptions.setupParser(subParser);
}
示例7: createCompileArguments
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
private void createCompileArguments(Subparser parser) {
ArgumentGroup groupOptions = parser.addArgumentGroup("options");
groupOptions.addArgument("input").metavar("<input>").dest(Dest.INPUT).required(true).help("input file (.jrxml) or directory");
groupOptions.addArgument("-o").metavar("<output>").dest(Dest.OUTPUT).help("directory or basename of outputfile(s)");
}
示例8: createListParamsArguments
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
private void createListParamsArguments(Subparser parser) {
ArgumentGroup groupOptions = parser.addArgumentGroup("options");
groupOptions.addArgument("input").metavar("<input>").dest(Dest.INPUT).required(true).help("input file (.jrxml) or (.jasper)");
}
示例9: createProcessArguments
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
private void createProcessArguments(Subparser parser) {
ArgumentGroup groupOptions = parser.addArgumentGroup("options");
groupOptions.addArgument("-f").metavar("<fmt>").dest(Dest.OUTPUT_FORMATS).
required(true).nargs("+").type(Arguments.enumType(OutputFormat.class)).
help("view, print, pdf, rtf, xls, xlsMeta, xlsx, docx, odt, ods, pptx, csv, csvMeta, html, xhtml, xml, jrprint");
groupOptions.addArgument("input").metavar("<input>").dest(Dest.INPUT).required(true).help("input file (.jrxml|.jasper|.jrprint)");
groupOptions.addArgument("-o").metavar("<output>").dest(Dest.OUTPUT).help("directory or basename of outputfile(s)");
//groupOptions.addArgument("-h", "--help").action(Arguments.help()).help("show this help message and exit");
ArgumentGroup groupCompileOptions = parser.addArgumentGroup("compile options");
groupCompileOptions.addArgument("-w", "--write-jasper").
dest(Dest.WRITE_JASPER).action(Arguments.storeTrue()).help("write .jasper file to imput dir if jrxml is processed");
ArgumentGroup groupFillOptions = parser.addArgumentGroup("fill options");
groupFillOptions.addArgument("-a").metavar("<filter>").dest(Dest.ASK)
.type(Arguments.enumType(AskFilter.class)).nargs("?")
.setConst(AskFilter.p)
.help("ask for report parameters. Filter: a, ae, u, ue, p, pe"
+ " (see usage)");
groupFillOptions.addArgument("-P").metavar("<param>").dest(Dest.PARAMS)
.nargs("+").help(
"report parameter: name=value [...]");
groupFillOptions.addArgument("-r").metavar("<resource>").dest(Dest.RESOURCE)
.nargs("?").setConst("").help(
"path to report resource dir or jar file. If <resource> is not"
+ " given the input directory is used.");
ArgumentGroup groupDatasourceOptions = parser.addArgumentGroup("datasource options");
groupDatasourceOptions.addArgument("-t").metavar("<dstype>").dest(Dest.DS_TYPE).
required(false).type(Arguments.enumType(DsType.class)).setDefault(DsType.none).
help("datasource type: none, csv, xml, json, mysql, postgres, oracle, generic (jdbc)");
Argument argDbHost = groupDatasourceOptions.addArgument("-H").metavar("<dbhost>").dest(Dest.DB_HOST).help("database host");
Argument argDbUser = groupDatasourceOptions.addArgument("-u").metavar("<dbuser>").dest(Dest.DB_USER).help("database user");
Argument argDbPasswd = groupDatasourceOptions.addArgument("-p").metavar("<dbpasswd>").dest(Dest.DB_PASSWD).setDefault("").help("database password");
Argument argDbName = groupDatasourceOptions.addArgument("-n").metavar("<dbname>").dest(Dest.DB_NAME).help("database name");
Argument argDbSid = groupDatasourceOptions.addArgument("--db-sid").metavar("<sid>").dest(Dest.DB_SID).help("oracle sid");
Argument argDbPort = groupDatasourceOptions.addArgument("--db-port").metavar("<port>").dest(Dest.DB_PORT).type(Integer.class).help("database port");
Argument argDbDriver = groupDatasourceOptions.addArgument("--db-driver").metavar("<name>").dest(Dest.DB_DRIVER).help("jdbc driver class name for use with type: generic");
Argument argDbUrl = groupDatasourceOptions.addArgument("--db-url").metavar("<jdbcUrl>").dest(Dest.DB_URL).help("jdbc url without user, passwd with type:generic");
groupDatasourceOptions.addArgument("--jdbc-dir").metavar("<dir>").dest(Dest.JDBC_DIR).type(File.class).help("directory where jdbc driver jars are located. Defaults to ./jdbc");
Argument argDataFile = groupDatasourceOptions.addArgument("--data-file").metavar("<file>").dest(Dest.DATA_FILE).type(File.class).help("input file for file based datasource");
groupDatasourceOptions.addArgument("--csv-first-row").metavar("true", "false").dest(Dest.CSV_FIRST_ROW).action(Arguments.storeTrue()).help("first row contains column headers");
Argument argCsvColumns = groupDatasourceOptions.addArgument("--csv-columns").metavar("<list>").dest(Dest.CSV_COLUMNS).help("Comma separated list of column names");
groupDatasourceOptions.addArgument("--csv-record-del").metavar("<delimiter>").dest(Dest.CSV_RECORD_DEL).setDefault(System.getProperty("line.separator")).help("CSV Record Delimiter - defaults to line.separator");
groupDatasourceOptions.addArgument("--csv-field-del").metavar("<delimiter>").dest(Dest.CSV_FIELD_DEL).setDefault(",").help("CSV Field Delimiter - defaults to \",\"");
groupDatasourceOptions.addArgument("--csv-charset").metavar("<charset>").dest(Dest.CSV_CHARSET).setDefault("utf-8").help("CSV charset - defaults to \"utf-8\"");
Argument argXmlXpath = groupDatasourceOptions.addArgument("--xml-xpath").metavar("<xpath>").dest(Dest.XML_XPATH).help("XPath for XML Datasource");
Argument argJsonQuery = groupDatasourceOptions.addArgument("--json-query").metavar("<jsonquery>").dest(Dest.JSON_QUERY).help("JSON query string for JSON Datasource");
ArgumentGroup groupOutputOptions = parser.addArgumentGroup("output options");
groupOutputOptions.addArgument("-N").metavar("<printername>").dest(Dest.PRINTER_NAME).help("name of printer");
groupOutputOptions.addArgument("-d").dest(Dest.WITH_PRINT_DIALOG).action(Arguments.storeTrue()).help("show print dialog when printing");
groupOutputOptions.addArgument("-s").metavar("<reportname>").dest(Dest.REPORT_NAME).help("set internal report/document name when printing");
groupOutputOptions.addArgument("-c").metavar("<copies>").dest(Dest.COPIES)
.type(Integer.class).choices(Arguments.range(1, Integer.MAX_VALUE))
.help("number of copies. Defaults to 1");
groupOutputOptions.addArgument("--out-field-del").metavar("<delimiter>").dest(Dest.OUT_FIELD_DEL).setDefault(",").help("Export CSV (Metadata) Field Delimiter - defaults to \",\"");
groupOutputOptions.addArgument("--out-charset").metavar("<charset>").dest(Dest.OUT_CHARSET).setDefault("utf-8").help("Export CSV (Metadata) Charset - defaults to \"utf-8\"");
allArguments.put(argDbHost.getDest(), argDbHost);
allArguments.put(argDbUser.getDest(), argDbUser);
allArguments.put(argDbPasswd.getDest(), argDbPasswd);
allArguments.put(argDbName.getDest(), argDbName);
allArguments.put(argDbSid.getDest(), argDbSid);
allArguments.put(argDbPort.getDest(), argDbPort);
allArguments.put(argDbDriver.getDest(), argDbDriver);
allArguments.put(argDbUrl.getDest(), argDbUrl);
allArguments.put(argDataFile.getDest(), argDataFile);
allArguments.put(argCsvColumns.getDest(), argCsvColumns);
allArguments.put(argXmlXpath.getDest(), argXmlXpath);
allArguments.put(argJsonQuery.getDest(), argJsonQuery);
}
示例10: configure
import net.sourceforge.argparse4j.inf.Subparser; //导入方法依赖的package包/类
@Override
public void configure(Subparser subparser) {
super.configure(subparser);
subparser.addArgument("-o", "--output").dest("output").help("Write output to <file> instead of stdout");
final ArgumentGroup tables = subparser.addArgumentGroup("Tables");
tables.addArgument("--tables").action(Arguments.storeTrue()).dest("tables")
.help("Check for added or removed tables (default)");
tables.addArgument("--ignore-tables").action(Arguments.storeFalse()).dest("tables").help("Ignore tables");
final ArgumentGroup columns = subparser.addArgumentGroup("Columns");
columns.addArgument("--columns").action(Arguments.storeTrue()).dest("columns")
.help("Check for added, removed, or modified tables (default)");
columns.addArgument("--ignore-columns").action(Arguments.storeFalse()).dest("columns").help("Ignore columns");
final ArgumentGroup views = subparser.addArgumentGroup("Views");
views.addArgument("--views").action(Arguments.storeTrue()).dest("views")
.help("Check for added, removed, or modified views (default)");
views.addArgument("--ignore-views").action(Arguments.storeFalse()).dest("views").help("Ignore views");
final ArgumentGroup primaryKeys = subparser.addArgumentGroup("Primary Keys");
primaryKeys.addArgument("--primary-keys").action(Arguments.storeTrue()).dest("primary-keys")
.help("Check for changed primary keys (default)");
primaryKeys.addArgument("--ignore-primary-keys").action(Arguments.storeFalse()).dest("primary-keys")
.help("Ignore primary keys");
final ArgumentGroup uniqueConstraints = subparser.addArgumentGroup("Unique Constraints");
uniqueConstraints.addArgument("--unique-constraints").action(Arguments.storeTrue()).dest("unique-constraints")
.help("Check for changed unique constraints (default)");
uniqueConstraints.addArgument("--ignore-unique-constraints").action(Arguments.storeFalse())
.dest("unique-constraints").help("Ignore unique constraints");
final ArgumentGroup indexes = subparser.addArgumentGroup("Indexes");
indexes.addArgument("--indexes").action(Arguments.storeTrue()).dest("indexes")
.help("Check for changed indexes (default)");
indexes.addArgument("--ignore-indexes").action(Arguments.storeFalse()).dest("indexes").help("Ignore indexes");
final ArgumentGroup foreignKeys = subparser.addArgumentGroup("Foreign Keys");
foreignKeys.addArgument("--foreign-keys").action(Arguments.storeTrue()).dest("foreign-keys")
.help("Check for changed foreign keys (default)");
foreignKeys.addArgument("--ignore-foreign-keys").action(Arguments.storeFalse()).dest("foreign-keys")
.help("Ignore foreign keys");
final ArgumentGroup sequences = subparser.addArgumentGroup("Sequences");
sequences.addArgument("--sequences").action(Arguments.storeTrue()).dest("sequences")
.help("Check for changed sequences (default)");
sequences.addArgument("--ignore-sequences").action(Arguments.storeFalse()).dest("sequences")
.help("Ignore foreign keys");
final ArgumentGroup data = subparser.addArgumentGroup("Data");
data.addArgument("--data").action(Arguments.storeTrue()).dest("data").help("Check for changed data")
.setDefault(Boolean.FALSE);
data.addArgument("--ignore-data").action(Arguments.storeFalse()).dest("data").help("Ignore data (default)")
.setDefault(Boolean.FALSE);
}