当前位置: 首页>>代码示例>>Java>>正文


Java Subparser类代码示例

本文整理汇总了Java中net.sourceforge.argparse4j.inf.Subparser的典型用法代码示例。如果您正苦于以下问题:Java Subparser类的具体用法?Java Subparser怎么用?Java Subparser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Subparser类属于net.sourceforge.argparse4j.inf包,在下文中一共展示了Subparser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的package包/类
@Override
public void configure(Subparser parser) {

  final Subparsers subparsers = parser.addSubparsers();

  final Subparser createParser = subparsers.addParser("create")
    .setDefault("subcommand", Command.create)
    .help("Create JSON Web Token for a subject");
  createParser.addArgument("subject").help("Name of the subject");
  super.configure(createParser);

  final Subparser verifyParser = subparsers.addParser("verify")
    .setDefault("subcommand", Command.verify)
    .help("Verify a JSON Web Token ");
  verifyParser.addArgument("jwt").help("The token to verify");
  super.configure(verifyParser);

  final Subparser signParser = subparsers.addParser("sign")
    .setDefault("subcommand", Command.sign)
    .help("Sign a JSON Web Token ");
  signParser.addArgument("claims").help("List of claims to sign i.e. (sub=user,scope=user admin)");
  super.configure(signParser);
}
 
开发者ID:atgse,项目名称:sam,代码行数:24,代码来源:OAuth2Command.java

示例2: buildParser

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的package包/类
@Override
public void buildParser(Subparser target)
{
    target.help("search for files or folders by name or tags");
    target.addArgument("path")
            .dest(ARG_PATH)
            .type(String.class)
            .help("path to search in");
    target.addArgument("--prefix")
            .dest(ARG_PREFIX)
            .type(String.class)
            .help("select only items with a name beginning with this");
    target.addArgument("--suffix")
            .dest(ARG_SUFFIX)
            .type(String.class)
            .help("select only items with a name ending with this");
    target.addArgument("--type")
            .dest(ARG_TYPE)
            .choices(ARG_TYPE_FILE, ARG_TYPE_FOLDER)
            .type(String.class)
            .help("select only items of this type");
    target.addArgument("--depth")
            .dest(ARG_DEPTH)
            .type(Integer.class)
            .help("recurse into subfolders this many times");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:27,代码来源:FindCommand.java

示例3: buildParser

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:25,代码来源:ImportFileCommand.java

示例4: buildParser

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:25,代码来源:LsCommand.java

示例5: buildParser

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:22,代码来源:HashCommand.java

示例6: buildParser

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:25,代码来源:RmCommand.java

示例7: buildParser

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:25,代码来源:ExportFileCommand.java

示例8: configure

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的package包/类
@Override public void configure(Subparser parser) {
  parser.addArgument("--keystore")
      .dest("keystore")
      .type(String.class)
      .setDefault("derivation.jceks")
      .help("keystore file name");

  parser.addArgument("--storepass")
      .dest("storepass")
      .type(String.class)
      .setDefault("CHANGE")
      .help("keystore password");

  parser.addArgument("--keysize")
      .dest("keysize")
      .type(Integer.class)
      .choices(128, 256)
      .setDefault(128)
      .help("keysize in bits");

  parser.addArgument("--alias")
      .dest("alias")
      .setDefault("baseKey")
      .help("keystore entry alias");
}
 
开发者ID:square,项目名称:keywhiz,代码行数:26,代码来源:GenerateAesKeyCommand.java

示例9: configure

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的package包/类
@Override
public void configure(final Subparser parser) {
  parser.addArgument("-s", "--subject")
      .dest("subject")
      .type(String.class)
      .required(true)
      .help("The subject CN");
  parser.addArgument("-o", "--out")
      .dest("out")
      .type(String.class)
      .required(true)
      .help("The name of the keystore to be created");
  parser.addArgument("-p", "--password")
      .dest("password")
      .type(String.class)
      .required(true)
      .help("The password of the keystore to be created");
  parser.addArgument("-c", "--cert")
      .dest("cert")
      .type(String.class)
      .required(true)
      .help("The certificate file to be created");
}
 
开发者ID:olivierlemasle,项目名称:java-certificate-authority,代码行数:24,代码来源:CreateSelfSignedCertificate.java

示例10: configure

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的package包/类
@Override
public void configure(Subparser subparser) {
    super.configure(subparser);

    subparser.addArgument("--" + OUT_OF_ORDER)
            .action(storeTrue())
            .setDefault(Boolean.FALSE)
            .dest(OUT_OF_ORDER)
            .help("Allows migrations to be run \"out of order\". " +
                    "If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored.");

    subparser.addArgument("--" + CLEAN_ON_VALIDATION_ERROR)
            .action(storeTrue())
            .setDefault(Boolean.FALSE)
            .dest(CLEAN_ON_VALIDATION_ERROR)
            .help("Whether to automatically call clean or not when a validation error occurs. " +
                    "This is exclusively intended as a convenience for development. " +
                    "Even tough we strongly recommend not to change migration scripts once they have been checked into SCM and run, this provides a way of dealing with this case in a smooth manner. " +
                    "The database will be wiped clean automatically, ensuring that the next migration will bring you back to the state checked into SCM. " +
                    "Warning! Do not enable in production !");
}
 
开发者ID:dropwizard,项目名称:dropwizard-flyway,代码行数:22,代码来源:DbValidateCommand.java

示例11: intializeSubCommand

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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() );
}
 
开发者ID:bazaarvoice,项目名称:jolt,代码行数:28,代码来源:DiffyCliProcessor.java

示例12: intializeSubCommand

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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() );
}
 
开发者ID:bazaarvoice,项目名称:jolt,代码行数:24,代码来源:SortCliProcessor.java

示例13: intializeSubCommand

import net.sourceforge.argparse4j.inf.Subparser; //导入依赖的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() );
}
 
开发者ID:bazaarvoice,项目名称:jolt,代码行数:27,代码来源:TransformCliProcessor.java

示例14: 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);
}
 
开发者ID:charite,项目名称:jannovar,代码行数:31,代码来源:JannovarDownloadOptions.java

示例15: 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);
}
 
开发者ID:charite,项目名称:jannovar,代码行数:26,代码来源:JannovarDBListOptions.java


注:本文中的net.sourceforge.argparse4j.inf.Subparser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。