net.sourceforge.argparse4j.inf.ArgumentParser.version()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中net.sourceforge.argparse4j.inf.ArgumentParser.version()方法的一些代码示例,展示了ArgumentParser.version()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArgumentParser.version()方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.ArgumentParser
类名称:ArgumentParser
方法名:version

ArgumentParser.version介绍

[英]Sets version string. It will be displayed #printVersion().

If the given usage contains ${prog} string, it will be replaced with the program name given in ArgumentParsers#newArgumentParser(String). This processed text will be printed without text-wrapping.
[中]设置版本字符串。它将显示为#printVersion()。
如果给定的用法包含${prog}字符串,它将被ArgumentParsers#newArgumentParser(字符串)中给定的程序名替换。此处理后的文本将在不进行文本换行的情况下打印。

代码示例

代码示例来源: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

.version(format("%s%nTested on Docker %s", NAME_AND_VERSION, TESTED_DOCKER_VERSION))
.description(format("%s%n%n%s%n%s", NAME_AND_VERSION, HELP_ISSUES, HELP_WIKI));

代码示例来源:origin: io.dropwizard/dropwizard-core

private ArgumentParser buildParser(JarLocation location) {
  final String usage = "java -jar " + location;
  final ArgumentParser p = ArgumentParsers.newArgumentParser(usage, false);
  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: AsamK/signal-cli

.defaultHelp(true)
.description("Commandline interface for Signal.")
.version(BaseConfig.PROJECT_NAME + " " + BaseConfig.PROJECT_VERSION);

代码示例来源:origin: br.com.thiaguten/umbrella-core

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: charite/jannovar

public static void main(String argv[]) {
  parser.version(getVersion());
  parser.addArgument("--version").help("Show Jannovar version").action(Arguments.version());
  parser.description("Jannovar CLI performs a series of VCF annotation tasks, including predicted "

代码示例来源:origin: at.molindo/helios-tools

.version(format("%s%nTested on Docker %s", NAME_AND_VERSION, TESTED_DOCKER_VERSION))
.description(format("%s%n%n%s%n%s", NAME_AND_VERSION, HELP_ISSUES, HELP_WIKI));

代码示例来源:origin: dariober/ASCIIGenome

public static Map<Command, ArgumentParser> parser(){
  
  Map<Command, ArgumentParser> argMap= new LinkedHashMap<Command, ArgumentParser>();
  // ----------------------------------
  ArgumentParser parser= ArgumentParsers
      .newArgumentParser("print")
      .defaultHelp(true)
      .version("Print lines for the tracks matched by `track_regex`.")
      .description("Print stuff");
  
  parser.addArgument("--nlines", "-n").help("Print up to this many lines, default 10. No limit if < 0.").type(Integer.class).setDefault(10);
  parser.addArgument("--full", "-full").help("Print full linesa dn wrap them if wider than the screen.").action(Arguments.storeTrue());
  parser.addArgument("--clip", "-clip").help("Clip lines longer than the screen width. This is the default.")
    .action(Arguments.storeTrue());
  parser.addArgument("--off", "-off").help("Turn off printing.").action(Arguments.storeTrue());
  parser.addArgument("--invert", "-v").help("Invert selection: apply changes to the tracks not selected by list of track_regex.").action(Arguments.storeTrue());
  parser.addArgument("track_regex").nargs("*").setDefault( new String[] {".*"} );
  parser.addArgument("--brief").action(Arguments.version());
  // ----------------------------------
  return argMap;
}

代码示例来源:origin: charite/jannovar

/**
 * Setup global {@link ArgumentParser}
 * 
 * @param parser
 *            {@link ArgumentParser} to setup
 */
public static void setupParser(ArgumentParser parser) {
  parser.version(Jannovar.getVersion());
  parser.addArgument("--version").help("Show Jannovar version").action(Arguments.version());
  ArgumentGroup verboseGroup = parser.addArgumentGroup("Verbosity Options");
  verboseGroup.addArgument("--report-no-progress").help("Disable progress report, more quiet mode")
      .dest("report_progress").setDefault(true).action(Arguments.storeFalse());
  verboseGroup.addArgument("-v", "--verbose").help("Enable verbose mode").dest("verbose").setDefault(false)
      .action(Arguments.storeTrue());
  verboseGroup.addArgument("-vv", "--very-verbose").help("Enable very verbose mode").dest("very_verbose")
      .setDefault(false).action(Arguments.storeTrue());
  ArgumentGroup proxyGroup = parser.addArgumentGroup("Proxy Options");
  proxyGroup.description("Configuration related to Proxy, note that environment variables *_proxy "
      + "and *_PROXY are also interpreted");
  proxyGroup.addArgument("--http-proxy").help("Set HTTP proxy to use, if any");
  proxyGroup.addArgument("--https-proxy").help("Set HTTPS proxy to use, if any");
  proxyGroup.addArgument("--ftp-proxy").help("Set FTP proxy to use, if any");
}

代码示例来源:origin: dariober/ASCIIGenome

.build()
        .defaultHelp(true)
        .version("${prog} " + VERSION)
        .description("DESCRIPTION\n"
+ "Genome browser at the command line.\n"

代码示例来源:origin: kiselev-dv/gazetteer

.description("Create alphabetical index of osm file features.");
parser.version(Versions.gazetteer);

相关文章