本文整理汇总了Java中net.sourceforge.argparse4j.impl.Arguments类的典型用法代码示例。如果您正苦于以下问题:Java Arguments类的具体用法?Java Arguments怎么用?Java Arguments使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Arguments类属于net.sourceforge.argparse4j.impl包,在下文中一共展示了Arguments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getArgumentParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
static ArgumentParser getArgumentParser() {
ArgumentParser parser = ArgumentParsers.newArgumentParser("dockerfile-image-update", true)
.description("Image Updates through Pull Request Automator");
parser.addArgument("-o", "--org")
.help("search within specific organization (default: all of github)");
/* Currently, because of argument passing reasons, you can only specify one branch. */
parser.addArgument("-b", "--branch")
.help("make pull requests for given branch name (default: master)");
parser.addArgument("-g", "--" + Constants.GIT_API)
.help("link to github api; overrides environment variable");
parser.addArgument("-f", "--auto-merge").action(Arguments.storeTrue())
.help("NOT IMPLEMENTED / set to automatically merge pull requests if available");
parser.addArgument("-m")
.help("message to provide for pull requests");
parser.addArgument("-c")
.help("additional commit message for the commits in pull requests");
return parser;
}
示例2: buildParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
@Override
public void buildParser(Subparser target)
{
target.help("write or import a file");
target.addArgument("path")
.dest(ARG_PATH)
.type(String.class)
.help("destination path in the archive");
target.addArgument("source")
.dest(ARG_SOURCE_FILE)
.type(Arguments.fileType().acceptSystemIn().verifyExists().verifyCanRead())
.help("file to import or - for stdin");
target.addArgument("--no-progress")
.dest(ARG_NO_PROGRESS)
.action(Arguments.storeTrue())
.setDefault(false)
.type(Boolean.class)
.help("don't display a progress bar while importing the file");
target.addArgument("-t", "--mediatype")
.dest(ARG_MEDIA_TYPE)
.choices(MediaType.ALL_TYPES)
.type(String.class)
.help("pick a media type");
}
示例3: buildParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
@Override
public void buildParser(Subparser target)
{
target.help("list the contents of a folder");
target.description(
"List the contents of a path in the archive. Use / to list the contents of the root directory. If the " +
"path is a file then the attributes of only that file will be printed. File sizes are formatted as IEC " +
"bytes (powers of 2) unless --machine-readable is used which will show the unformatted number of bytes."
);
target.addArgument("path")
.dest(ARG_PATH)
.type(String.class)
.help("directory path to list");
target.addArgument("-H", "--no-headings")
.dest(ARG_NOHEADINGS)
.type(Boolean.class)
.action(Arguments.storeTrue())
.help("disable headings in the output");
target.addArgument("-M", "--machine-readable")
.dest(ARG_MACHINEREADABLE)
.type(Boolean.class)
.action(Arguments.storeTrue())
.help("format data in machine readable form");
}
示例4: buildParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
@Override
public void buildParser(Subparser target)
{
target.help("calculate a hash over the contents of a file in the archive");
target.addArgument("path")
.dest(ARG_PATH)
.type(String.class)
.help("path of the file in the archive");
target.addArgument("-a", "--algorithm")
.dest(ARG_ALGORITHM)
.type(String.class)
.choices("md5", "sha1", "sha224", "sha256")
.setDefault("md5")
.help("the digest algorithm to use");
target.addArgument("--no-progress")
.dest(ARG_NO_PROGRESS)
.action(Arguments.storeTrue())
.setDefault(false)
.type(Boolean.class)
.help("don't display a progress bar while hashing the file");
}
示例5: buildParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
@Override
public void buildParser(Subparser target)
{
target.help("remove a file or directory");
target.addArgument("path")
.dest(ARG_PATH)
.type(String.class)
.help("path of directory to remove from the archive");
target.addArgument("-r", "--recursive")
.dest(ARG_RECURSIVE)
.type(Boolean.class)
.action(Arguments.storeTrue())
.help("remove all subfolders and files");
target.addArgument("-n", "--no-wipe")
.dest(ARG_NOWIPE)
.type(Boolean.class)
.action(Arguments.storeTrue())
.help("dont wipe deleted files blocks");
target.addArgument("-q", "--no-progress")
.dest(ARG_NOPROGRESS)
.type(Boolean.class)
.action(Arguments.storeTrue())
.help("dont display progress bar if wiping blocks");
}
示例6: buildParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
@Override
public void buildParser(Subparser target)
{
target.help("read or export a file from the archive");
target.addArgument("path")
.dest(ARG_PATH)
.type(String.class)
.help("source path in the archive");
target.addArgument("destination")
.dest(ARG_DESTINATION_FILE)
.type(Arguments.fileType().acceptSystemIn())
.help("file to export to or - for stdout");
target.addArgument("--ignore-integrity-error")
.dest(ARG_IGNORE_INTEGRITY_CHECK)
.type(Boolean.class)
.action(Arguments.storeTrue())
.help("ignore integrity check error caused by data corruption");
target.addArgument("--no-progress")
.dest(ARG_NO_PROGRESS)
.action(Arguments.storeTrue())
.setDefault(false)
.type(Boolean.class)
.help("don't display a progress bar while importing the file");
}
示例7: main
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
public static void main(String[] args) {
ArgumentParser parser = ArgumentParsers.newArgumentParser("AngusMe");
parser.description("Angus SDK configurator");
parser.addArgument("-s", "--show").action(Arguments.storeTrue())
.help("display current configuration if exists");
parser.addArgument("-d", "--delete").action(Arguments.storeTrue())
.help("remove current configuration if exists");
try {
Namespace res = parser.parseArgs(args);
if (res.getBoolean("show")) {
show();
} else if (res.getBoolean("delete")) {
delete();
} else {
update();
}
} catch (ArgumentParserException e) {
parser.handleError(e);
}
}
示例8: loadTagSentParameters
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
public final void loadTagSentParameters()
{
tagSentParser.addArgument("-m", "--model")
.setDefault("default")
.help("Pass the model to do the tagging as a parameter.\n");
tagSentParser.addArgument("-lm", "--lemmaModel")
.setDefault("default")
.help("Pass the model to do the lemmatization as a parameter.\n");
tagSentParser.addArgument("-d", "--dir")
.required(true)
.help("directory to store tagged files.\n");
tagSentParser.addArgument("-f", "--format")
.setDefault("tabNotagged")
.choices("tabNotagged", "semeval2015")
.help("format of the input corpus.\n");
tagSentParser.addArgument("-p", "--print")
.action(Arguments.storeTrue())
.help("Whether the tagged files should be printed as a corpus.\n");
tagSentParser.addArgument("-l","--language")
.setDefault("en")
.choices("de", "en", "es", "eu", "it", "nl", "fr")
.help("Choose language; if not provided it defaults to: \n"
+ "\t- If the input format is NAF, the language value in incoming NAF file."
+ "\t- en otherwise.\n");
}
示例9: parseArgs
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
private static Namespace parseArgs(String[] args) {
ArgumentParser parser =
ArgumentParsers.newArgumentParser("moco", false).description("The Monty compiler.").epilog(
"Without -S or -c the program is compiled and directly executed.");
parser.addArgument("--help").action(Arguments.help()).help("Print this help and exit.");
parser.addArgument("-S", "--emit-assembly").action(Arguments.storeTrue()).dest("emitAssembly").help(
"Emit the LLVM assembly and stop.");
parser.addArgument("-c", "--compile-only").action(Arguments.storeTrue()).dest("compileOnly").help(
"Only compile the executable without running it.");
parser.addArgument("-e", "--stop-on-first-error").action(Arguments.storeTrue()).dest("stopOnFirstError").help(
"Stop the compilation on the first encountered error.");
parser.addArgument("-p", "--print-ast").action(Arguments.storeTrue()).dest("printAST").help("Print the AST.");
parser.addArgument("-d", "--debug-parsetree").action(Arguments.storeTrue()).dest("debugParseTree").help(
"Debug the parsetree without running anything.");
parser.addArgument("-o").metavar("<file>").dest("outputFile").help("Write output to <file>.");
parser.addArgument("file").nargs("?").help("Monty file to run.");
Namespace ns = null;
try {
ns = parser.parseArgs(args);
} catch (ArgumentParserException ape) {
parser.handleError(ape);
}
return ns;
}
示例10: intializeSubCommand
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
/**
* Initialize the arg parser for the Diffy sub command
*
* @param subparsers The Subparsers object to attach the new Subparser to
*/
@Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser diffyParser = subparsers.addParser( "diffy" )
.description( "Jolt CLI Diffy Tool. This tool will ingest two JSON inputs (from files or standard input) and " +
"perform the Jolt Diffy operation to detect any differences. The program will return an exit code of " +
"0 if no differences are found or a 1 if a difference is found or an error is encountered." )
.defaultHelp( true );
diffyParser.addArgument( "filePath1" ).help( "File path to feed to Input #1 for the Diffy operation. " +
"This file should contain valid JSON." )
.type( Arguments.fileType().verifyExists().verifyIsFile().verifyCanRead() );
diffyParser.addArgument( "filePath2" ).help( "File path to feed to Input #2 for the Diffy operation. " +
"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 ); // these last two method calls make filePath2 optional
diffyParser.addArgument( "-s" ).help( "Diffy will suppress output and run silently." )
.action( Arguments.storeTrue() );
diffyParser.addArgument( "-a" ).help( "Diffy will not consider array order when detecting differences" )
.action( Arguments.storeTrue() );
}
示例11: intializeSubCommand
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
/**
* 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() );
}
示例12: intializeSubCommand
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的package包/类
/**
* Initialize the arg parser for the Transform sub command
*
* @param subparsers The Subparsers object to attach the new Subparser to
*/
@Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser transformParser = subparsers.addParser( "transform" )
.description( "Jolt CLI Transform Tool. This tool will ingest a JSON spec file and an JSON input (from a file or " +
"standard input) and run the transforms specified in the spec file on the input. The program will return an " +
"exit code of 0 if the input is transformed successfully or a 1 if an error is encountered" )
.defaultHelp( true );
File nullFile = null;
transformParser.addArgument( "spec" ).help( "File path to Jolt Transform Spec to execute on the input. " +
"This file should contain valid JSON." )
.type( Arguments.fileType().verifyExists().verifyIsFile().verifyCanRead() );
transformParser.addArgument( "input" ).help( "File path to the input JSON for the Jolt Transform operation. " +
"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( nullFile ); // these last two method calls make input optional
transformParser.addArgument( "-u" ).help( "Turns off pretty print for the output. Output will be raw json with no formatting." )
.action( Arguments.storeTrue() );
}
示例13: setupParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的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);
}
示例14: setupParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的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);
}
示例15: setupParser
import net.sourceforge.argparse4j.impl.Arguments; //导入依赖的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);
}