Example #1
1
  public void test13666() {
    Options options = new Options();
    Option dir = OptionBuilder.withDescription("dir").hasArg().create('d');
    options.addOption(dir);

    final PrintStream oldSystemOut = System.out;
    try {
      final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
      final PrintStream print = new PrintStream(bytes);

      // capture this platform's eol symbol
      print.println();
      final String eol = bytes.toString();
      bytes.reset();

      System.setOut(new PrintStream(bytes));
      try {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("dir", options);
      } catch (Exception exp) {
        fail("Unexpected Exception: " + exp.getMessage());
      }
      assertEquals("usage: dir" + eol + " -d <arg>   dir" + eol, bytes.toString());
    } finally {
      System.setOut(oldSystemOut);
    }
  }
Example #2
0
  private static boolean setOptions(String[] lcommand) {

    Options loptions = new Options();
    loptions.addOption(new Option("d", "debug", false, "print debug information (highly verbose)"));
    loptions.addOption(new Option("o", "stdout", false, "print output files to standard output"));
    loptions.addOption(new Option("w", "warning", false, "print warning messages"));

    CommandLineParser clparser = new PosixParser();
    try {
      cmd = clparser.parse(loptions, lcommand);
    } catch (org.apache.commons.cli.ParseException e) {
      String mytoolcmd = "java -jar stave.jar";
      String myoptlist = " <options> <source files>";
      String myheader = "Convert JavaParser's AST to OpenJDK's AST";
      String myfooter = "More info: https://github.com/pcgomes/javaparser2jctree";

      HelpFormatter formatter = new HelpFormatter();
      // formatter.printUsage( new PrintWriter(System.out,true), 100, "java -jar synctask.jar",
      // loptions );
      // formatter.printHelp( mytoolcmd + myoptlist, myheader, loptions, myfooter, false);
      formatter.printHelp(mytoolcmd + myoptlist, loptions, false);
      return (false);
    }

    return (true);
  }
Example #3
0
  private static void printHelp(Options options) {
    String header = "Enter some parameters\n\n";
    String footer = "\nPlease report issues at [email protected]";

    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.printHelp("aaaJava", header, options, footer, true);
  }
Example #4
0
 private void printUsage(boolean tsqlMode) {
   if (!tsqlMode) {
     HelpFormatter formatter = new HelpFormatter();
     formatter.printHelp("getconf <key> [options]", options);
   }
   System.out.println(
       defaultLeftPad + "key" + defaultDescPad + "gets a specific key from the configuration");
 }
Example #5
0
 private static void print_help() {
   String header =
       "MapCore application. CMPUT 402 Winter 2016 Project.\n"
           + "Must run as either importer, simulator, webapi or converter.\n\n";
   String footer =
       "\nPlease report issues at\nhttps://github.com/cmput402w2016/CMPUT402W16T1/issues";
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp("MapCore", header, options, footer, true);
 }
Example #6
0
  /**
   * Load the Configuration file with the values from the command line and config files, and place
   * stuff in the DistrubutedCacheService as needed
   *
   * @param conf The Configuration to populate
   * @param args The command line arguments
   * @throws Exception
   */
  public static void initalizeConf(Configuration conf, String[] args) throws Exception {
    // Parse the arguments and make sure the required args are there
    final CommandLine commandLine;
    final Options options = constructGnuOptions();
    try {
      commandLine = new GnuParser().parse(options, args);
    } catch (MissingOptionException ex) {
      HelpFormatter help = new HelpFormatter();
      help.printHelp("hadoop jar <jarFile> " + FrameworkDriver.class.getCanonicalName(), options);
      return;
    } catch (Exception ex) {
      ex.printStackTrace();
      return;
    }

    final String userConfFilePath = commandLine.getOptionValue("amino_config_file_path", "");
    final String aminoDefaultConfigPath = commandLine.getOptionValue("amino_default_config_path");
    final String baseDir = commandLine.getOptionValue("base_dir");

    stopOnFirstPhase = commandLine.hasOption("stop");

    // Set the base dir config value if it was provided.
    if (StringUtils.isNotEmpty(baseDir)) {
      conf.set(AminoConfiguration.BASE_DIR, baseDir);
    }

    conf.set(AminoConfiguration.DEFAULT_CONFIGURATION_PATH_KEY, aminoDefaultConfigPath);

    // create a single DistributedCacheService so that multiple cache entries are deduped.
    // Cache files are added after each config is loaded in case the the property value changes.
    final DistributedCacheService distributedCacheService = new DistributedCacheService();

    // 1. load AminoDefaults
    AminoConfiguration.loadAndMergeWithDefault(conf, true);
    distributedCacheService.addFilesToDistributedCache(conf);

    // 2. load user config files, allowing them to overwrite
    if (!StringUtils.isEmpty(userConfFilePath)) {
      for (String path : getUserConfigFiles(userConfFilePath)) {
        Configuration userConf = new Configuration(false);
        logger.info("Grabbing configuration information from: " + path);
        userConf.addResource(new FileInputStream(path));
        HadoopConfigurationUtils.mergeConfs(conf, userConf);
      }
    }
    distributedCacheService.addFilesToDistributedCache(conf);

    // 3. load command line arguments as properties, allowing them to overwrite
    final Properties propertyOverrides = commandLine.getOptionProperties("property_override");
    for (Object key : propertyOverrides.keySet()) {
      conf.set((String) key, (String) propertyOverrides.get(key));
    }
    distributedCacheService.addFilesToDistributedCache(conf);
  }
Example #7
0
 public void test21215() {
   Options options = new Options();
   HelpFormatter formatter = new HelpFormatter();
   String SEP = System.getProperty("line.separator");
   String header = SEP + "Header";
   String footer = "Footer";
   StringWriter out = new StringWriter();
   formatter.printHelp(new PrintWriter(out), 80, "foobar", header, options, 2, 2, footer, true);
   assertEquals(
       "usage: foobar" + SEP + "" + SEP + "Header" + SEP + "" + SEP + "Footer" + SEP,
       out.toString());
 }
Example #8
0
  public static void main(String[] args) throws Exception {
    long t0 = System.currentTimeMillis();

    final String OPT_JAR_FILE = "aijar";
    final String OPT_CLASSNAME = "ainame";

    Options options =
        new Options()
            .addOption(
                Option.builder(OPT_JAR_FILE)
                    .hasArg()
                    .argName("jarfile")
                    .required()
                    .desc("The path to the jar file")
                    .build())
            .addOption(
                Option.builder(OPT_CLASSNAME)
                    .hasArg()
                    .argName("classname")
                    .required()
                    .desc("The full classpath of the Ai class")
                    .build())
            .addOption(timeOpt);
    DraughtStateParser.addOptions(options);
    HelpFormatter formatter = new HelpFormatter();
    CommandLine line = new DefaultParser().parse(options, args);

    DraughtsPlayer player;
    Integer time;
    DraughtsState draughtsState;
    try {
      File aiJar = new File(line.getOptionValue(OPT_JAR_FILE));
      if (!aiJar.canRead() || !aiJar.isFile()) {
        throw new ParseException("Could not read from aijar");
      }
      String className = line.getOptionValue(OPT_CLASSNAME);
      player = Main.getFromClass(aiJar, className);
      time = Integer.parseInt(line.getOptionValue(OPT_TIME));
      draughtsState = DraughtStateParser.parseDraughtsState(line);
    } catch (JSONException e) {
      formatter.printHelp("java -jar wtcl.jar", options);
      System.err.println(
          "JSON Exception on string " + line.getOptionValue(DraughtStateParser.OPT_BOARD));
      throw e;
    } catch (Exception e) {
      formatter.printHelp("java -jar wtcl.jar", options);
      throw e;
    }
    execute(player, draughtsState, time, t0);
  }
Example #9
0
 /** prints usage info */
 public void help() {
   final HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(
       80,
       "run-project [options]",
       "options:",
       options,
       "Examples:\n"
           + "\trun-project -p project --action create; # Initialize project\n"
           + "\trun-project -p project --action install; # Install resources and their modules\n"
           + "\trun-project -p project --action install --pview; # Install resources and their modules and process view files\n"
           + "\trun-project -p project --action pview; # Install process view files for deployed resources\n"
           + "\trun-project -p project --action purge ; # purges all resources\n"
           + "\n");
 }
  public static void main(String[] args) {
    Options options = KeyGenCLI.buildOptions();
    HelpFormatter helpFormatter = new HelpFormatter();
    CommandLineParser parser = new GnuParser();

    try {
      CommandLine commandLine = parser.parse(options, args);
      String service = commandLine.getOptionValue("service");
      String key = Crypto.generateAes128KeyWithSeed(service);

      if (key == null) {
        throw new Exception("Key was not generated!");
      }

      JSONObject keyObject = new JSONObject();
      keyObject.put("name", service);
      keyObject.put("data", key);

      System.out.println(String.format("Key: `%s`\n", key));

      System.out.println("Key object:");
      System.out.println(keyObject.toString());
    } catch (MissingOptionException e) {
      System.out.println("Missing required option(s)!");
      helpFormatter.printHelp(
          "\nKeyGenCLI",
          "This tool generates a unique key and prints the result.",
          options,
          "",
          true);
    } catch (UnrecognizedOptionException e) {
      System.out.println("Unrecognized option!");
      helpFormatter.printHelp(
          "\nKeyGenCLI",
          "This tool generates a unique key and prints the result.",
          options,
          "",
          true);
    } catch (ParseException e) {
      e.printStackTrace();
    } catch (JSONException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #11
0
  public static CommandLine parseCmdLine(
      final String appName, String[] args, Options options, CommandLineParser parser) {
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(110);
    CommandLine commandLine = null;
    try {
      commandLine = parser.parse(options, args);
      if (commandLine.hasOption('h')) {
        hf.printHelp(appName, options, true);
        return null;
      }
    } catch (ParseException e) {
      hf.printHelp(appName, options, true);
    }

    return commandLine;
  }
Example #12
0
 private static void printUsage(ParseException e) {
   HelpFormatter helpFormatter = new HelpFormatter();
   PrintWriter pw = new PrintWriter(System.out);
   pw.print(e.getMessage());
   pw.println();
   helpFormatter.printHelp(
       pw,
       80,
       "java " + FtpBackup.class.getName(),
       "",
       CommandLineOption.ALL_COMMAND_LINE_OPTIONS,
       3,
       3,
       "",
       true);
   pw.flush();
   pw.close();
 }
Example #13
0
  private void parseCmdLine(String[] args) {
    CommandLineParser parser = new PosixParser();

    Options options = new Options();
    options.addOption("v", "version", false, "Q2's version");
    options.addOption("d", "deploydir", true, "Deployment directory");
    options.addOption("r", "recursive", false, "Deploy subdirectories recursively");
    options.addOption("h", "help", false, "Usage information");
    options.addOption("C", "config", true, "Configuration bundle");
    options.addOption("e", "encrypt", true, "Encrypt configuration bundle");
    options.addOption("i", "cli", false, "Command Line Interface");
    options.addOption("c", "command", true, "Command to execute");

    try {
      CommandLine line = parser.parse(options, args);
      if (line.hasOption("v")) {
        displayVersion();
        System.exit(0);
      }
      if (line.hasOption("h")) {
        HelpFormatter helpFormatter = new HelpFormatter();
        helpFormatter.printHelp("Q2", options);
        System.exit(0);
      }
      if (line.hasOption("c")) {
        cli = new CLI(this, line.getOptionValue("c"), line.hasOption("i"));
      } else if (line.hasOption("i")) cli = new CLI(this, null, true);

      String dir = DEFAULT_DEPLOY_DIR;
      if (line.hasOption("d")) {
        dir = line.getOptionValue("d");
      }
      recursive = line.hasOption("r");
      this.deployDir = new File(dir);
      if (line.hasOption("C")) deployBundle(new File(line.getOptionValue("C")), false);
      if (line.hasOption("e")) deployBundle(new File(line.getOptionValue("e")), true);
    } catch (MissingArgumentException e) {
      System.out.println("ERROR: " + e.getMessage());
      System.exit(1);
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
  }
Example #14
0
  public void test19383() {
    Options options = new Options();
    options.addOption(new Option("a", "aaa", false, "aaaaaaa"));
    options.addOption(new Option(null, "bbb", false, "bbbbbbb"));
    options.addOption(new Option("c", null, false, "ccccccc"));

    HelpFormatter formatter = new HelpFormatter();
    String SEP = System.getProperty("line.separator");
    StringWriter out = new StringWriter();
    formatter.printHelp(new PrintWriter(out), 80, "foobar", "", options, 2, 2, "", true);
    assertEquals(
        "usage: foobar [-a] [--bbb] [-c]"
            + SEP
            + "  -a,--aaa  aaaaaaa"
            + SEP
            + "     --bbb  bbbbbbb"
            + SEP
            + "  -c        ccccccc"
            + SEP,
        out.toString());
  }
Example #15
0
  public static void main(String[] args) {

    String formatstr = "ws [--in][--out][--dd][--sw][-h]";
    Options opt = new Options();
    // opt.addOption(OptionBuilder.withArgName("in").hasArg().withDescription("search for buildfile
    // towards the root of the filesystem and use it").create("O"));
    opt.addOption(
        OptionBuilder.withLongOpt("in")
            .withDescription("file path of those files need to be processed")
            .withValueSeparator('=')
            .hasArg()
            .create());
    opt.addOption(
        OptionBuilder.withLongOpt("out")
            .withDescription("file path to store result")
            .withValueSeparator('=')
            .hasArg()
            .create());
    opt.addOption(
        OptionBuilder.withLongOpt("dd")
            .withDescription("file path of dictionary")
            .withValueSeparator('=')
            .hasArg()
            .create());
    opt.addOption(
        OptionBuilder.withLongOpt("sw")
            .withDescription("file path of stop words")
            .withValueSeparator('=')
            .hasArg()
            .create());
    opt.addOption("h", "help", false, "print help for the command.");

    if (args.length == 0) {
      HelpFormatter hf = new HelpFormatter();
      hf.printHelp(formatstr, "", opt, "");
      return;
    } else {
      parse_args(args, formatstr, opt);
    }
  }
Example #16
0
  private static void parse_args(String[] args, String formatstr, Options opt) {
    HelpFormatter formatter = new HelpFormatter();
    CommandLineParser parser = new PosixParser();
    CommandLine cl = null;

    try {
      cl = parser.parse(opt, args);
    } catch (ParseException e) {
      formatter.printHelp(formatstr, opt); // 如果发生异常,则打印出帮助信息
    }

    if (cl.hasOption("in") && cl.hasOption("out") && cl.hasOption("dd") && cl.hasOption("sw")) {
      String stopWordsPath = cl.getOptionValue("sw");
      String inPath = cl.getOptionValue("in");
      String outPath = cl.getOptionValue("out");
      String dicPath = cl.getOptionValue("dd");
      processOperation(stopWordsPath, inPath, outPath, dicPath);
    } else {
      HelpFormatter hf = new HelpFormatter();
      hf.printHelp(formatstr, "", opt, "");
      return;
    }
  }
Example #17
0
 public void help() {
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp("JtSysMon", options);
 }
Example #18
0
  public static void main(String[] args) {
    Options options = new Options();

    options.addOption("h", false, "Print this help");
    options.addOption("t", false, "Test mode. Doesn't write anything to the database.");
    options.addOption("v", false, "Verbose mode. Use if you like lots of tasty output.");

    Option metadataFileOption =
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription("Process multiple reports using a StatsDB metadata table file")
            .create("m");
    options.addOption(metadataFileOption);

    Option inputFileOption =
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription("Use given input report file")
            .create("f");
    options.addOption(inputFileOption);

    Option parserTypeOption =
        OptionBuilder.withArgName("fastqc,other")
            .hasArg()
            .withDescription("Use specified parser type")
            .create("p");
    options.addOption(parserTypeOption);

    Option runNameOption =
        OptionBuilder.withArgName("run")
            .hasArg()
            .withDescription("Associate the report with a given run name")
            .create("r");
    options.addOption(runNameOption);

    CommandLineParser parser = new BasicParser();
    try {
      CommandLine line = parser.parse(options, args);

      if (line.hasOption("h")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("statsdb.jar", options);
      }

      QcReportParser<File> qcParser = null;
      if (line.hasOption("p")) {
        String parserType = line.getOptionValue("p");
        if ("".equals(parserType) || "fastqc".equals(parserType)) {
          qcParser = new FastQCReportParser();
        } else if ("other".equals(parserType)) {
          log.error("Unsupported option 'other'. Please specify a parser type.");
          System.exit(1);
        }
      } else {
        log.info("No parser type specified. Using FASTQC as the default report type.");
        qcParser = new FastQCReportParser();
      }

      List<QCAnalysis> qcas = new ArrayList<>();

      if (line.hasOption("m")) {
        File inputfile = new File(line.getOptionValue("m"));
        if (!inputfile.exists()) {
          log.error("No input metadata file specified.");
          System.exit(1);
        } else {
          AnalysisMetadataParser amp = new AnalysisMetadataParser();
          List<QCAnalysis> pqcas = amp.parseMetadataFile(inputfile);
          for (QCAnalysis pqca : pqcas) {
            try {
              String path = pqca.getProperty("path_to_analysis");
              File reportFileToParse = new File(path);
              if (reportFileToParse.exists()) {
                qcParser.parseReport(reportFileToParse, pqca);
              }
            } catch (QCAnalysisException e) {
              log.error(
                  "Cannot use metadata file - no property 'path_to_analysis' available. For each report line, this "
                      + "should point to the file path where the report file is located.");
              System.exit(1);
            }
          }
          qcas.addAll(pqcas);
        }
      } else if (line.hasOption("f")) {
        File inputfile = new File(line.getOptionValue("f"));
        if (!inputfile.exists()) {
          log.error("No input report file specified.");
          System.exit(1);
        } else {
          QCAnalysis qca = new DefaultQCAnalysis();

          if (line.hasOption("r")) {
            qca.addProperty("run", line.getOptionValue("r"));
          } else {
            log.warn(
                "No run name specified. Parsed report metrics will only be queryable on raw read filename.");
          }
          qcParser.parseReport(inputfile, qca);
          qcas.add(qca);
        }
      } else {
        log.error("No input metadata or report file specified.");
        System.exit(1);
      }

      for (QCAnalysis qca : qcas) {
        if (line.hasOption("v")) {
          log.info("Parsed general values:");
          for (Map.Entry<String, String> p : qca.getGeneralValues().entrySet()) {
            log.info("\t\\_ " + p.getKey() + ":" + p.getValue());
          }

          log.info("Parsed partition values:");
          for (PartitionValue p : qca.getPartitionValues()) {
            log.info(
                "\t\\_ "
                    + p.getKey()
                    + ":"
                    + p.getValue()
                    + ":"
                    + p.getPosition()
                    + ":"
                    + p.getSize());
          }

          log.info("Parsed position values:");
          for (PositionValue p : qca.getPositionValues()) {
            log.info("\t\\_ " + p.getKey() + ":" + p.getValue() + ":" + p.getPosition());
          }
        }

        if (!line.hasOption("t")) {
          // write stuff to the database
          log.info("Writing analysis report to the database:");
          try {
            ApplicationContext context = new ClassPathXmlApplicationContext("db-config.xml");
            QCAnalysisStore store = (QCAnalysisStore) context.getBean("qcAnalysisStore");
            if (line.hasOption("v")) {
              store.setVerbose(true);
            }
            store.insertAnalysis(qca);
            log.info("SUCCESS");
          } catch (QCAnalysisException e) {
            log.error("FAIL: Cannot insert analysis into the database: " + e.getMessage());
            e.printStackTrace();
            System.exit(1);
          } catch (DataAccessException e) {
            log.error("FAIL: Error inserting analysis into the database: " + e.getMessage());
            e.printStackTrace();
            System.exit(1);
          }
        }
      }
    } catch (ParseException e) {
      log.error("Parsing failed.  Reason: " + e.getMessage());
      e.printStackTrace();
      System.exit(1);
    } catch (QCAnalysisException e) {
      log.error("Unable to parse QC report: " + e.getMessage());
      e.printStackTrace();
      System.exit(1);
    }
    System.exit(0);
  }
Example #19
0
 public void printHelp() {
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(
       "liquibase-sdk [global options] [command] [command options]", globalOptions);
 }
Example #20
0
 public static void printCommandLineHelp(final String appName, final Options options) {
   HelpFormatter hf = new HelpFormatter();
   hf.setWidth(110);
   hf.printHelp(appName, options, true);
 }
Example #21
0
  @SuppressWarnings("static-access")
  public static void main(String[] args) throws Exception {
    MZTabErrorTypeMap typeMap = new MZTabErrorTypeMap();

    // Definite command line
    CommandLineParser parser = new PosixParser();
    Options options = new Options();

    String helpOpt = "help";
    options.addOption("h", helpOpt, false, "print help message");

    String msgOpt = "message";
    String codeOpt = "code";
    Option msgOption =
        OptionBuilder.withArgName(codeOpt)
            .hasArgs(2)
            .withValueSeparator()
            .withDescription("print Error/Warn detail message based on code number.")
            .create(msgOpt);
    options.addOption(msgOption);

    String outOpt = "outFile";
    options.addOption(
        outOpt,
        true,
        "Record error/warn messages into outfile. If not set, print message on the screen. ");

    String checkOpt = "check";
    String inFileOpt = "inFile";
    Option checkOption =
        OptionBuilder.withArgName(inFileOpt)
            .hasArgs(2)
            .withValueSeparator()
            .withDescription(
                "Choose a file from input directory. This parameter should not be null!")
            .create(checkOpt);
    options.addOption(checkOption);

    String levelOpt = "level";
    options.addOption(
        levelOpt, true, "Choose validate level(Info, Warn, Error), default level is Error!");

    String convertOpt = "convert";
    String formatOpt = "format";
    Option convertOption =
        OptionBuilder.withArgName(inFileOpt + ", " + formatOpt)
            .hasArgs()
            .withValueSeparator()
            .withDescription(
                "Converts the given format file (PRIDE or MZIDENTML) to an mztab file.")
            .create(convertOpt);
    options.addOption(convertOption);

    // Parse command line
    CommandLine line = parser.parse(options, args);
    if (line.hasOption(helpOpt)) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("jmztab", options);
    } else if (line.hasOption(msgOpt)) {
      String[] values = line.getOptionValues(msgOpt);
      Integer code = new Integer(values[1]);
      MZTabErrorType type = typeMap.getType(code);

      if (type == null) {
        System.out.println("Not found MZTabErrorType, the code is :" + code);
      } else {
        System.out.println(type);
      }
    } else {

      File outFile = null;
      if (line.hasOption(outOpt)) {
        outFile = new File(line.getOptionValue(outOpt));
      }

      OutputStream out =
          outFile == null ? System.out : new BufferedOutputStream(new FileOutputStream(outFile));

      MZTabErrorType.Level level = MZTabErrorType.Level.Error;
      if (line.hasOption(levelOpt)) {
        level = MZTabErrorType.findLevel(line.getOptionValue(levelOpt));
      }

      if (line.hasOption(checkOpt)) {
        String[] values = line.getOptionValues(checkOpt);
        if (values.length != 2) {
          throw new IllegalArgumentException("Not setting input file!");
        }
        File inFile = new File(values[1].trim());
        System.out.println("Begin check mztab file: " + inFile.getAbsolutePath());
        new MZTabFileParser(inFile, out, level);
      } else if (line.hasOption(convertOpt)) {
        String[] values = line.getOptionValues(convertOpt);
        File inFile = null;
        MassSpecFileFormat format = MassSpecFileFormat.PRIDE;
        for (int i = 0; i < values.length; i++) {
          String type = values[i++].trim();
          String value = values[i].trim();
          if (type.equals(inFileOpt)) {
            inFile = new File(value.trim());
          } else if (type.equals(formatOpt)) {
            format = getFormat(value.trim());
          }
        }
        if (inFile == null) {
          throw new IllegalArgumentException("Not setting input file!");
        }

        System.out.println(
            "Begin converting "
                + inFile.getAbsolutePath()
                + " which format is "
                + format.name()
                + " to mztab file.");
        MZTabFileConverter converter = new MZTabFileConverter(inFile, format);
        MZTabFile tabFile = converter.getMZTabFile();
        MZTabErrorList errorList = converter.getErrorList();

        if (errorList.isEmpty()) {
          System.out.println("Begin writing mztab file.");
          tabFile.printMZTab(out);
        } else {
          System.out.println("There are errors in mztab file.");
          errorList.print(out);
        }
      }

      System.out.println("Finish!");
      System.out.println();
      out.close();
    }
  }
  public static void main(String[] args) {
    String logConfig = System.getProperty("log-config");
    if (logConfig == null) {
      logConfig = "log-config.txt";
    }

    Options options = new Options();
    options.addOption("h", "help", false, "print this message");
    options.addOption("v", "version", false, "output version information and exit");
    options.addOption(OptionBuilder.withDescription("trace mode").withLongOpt("trace").create());
    options.addOption(OptionBuilder.withDescription("debug mode").withLongOpt("debug").create());
    options.addOption(OptionBuilder.withDescription("info mode").withLongOpt("info").create());
    options.addOption(
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription(
                "file from which to read the labelled training set in tabular format (reference annotation)")
            .isRequired()
            .withLongOpt("labelled")
            .create("l"));
    options.addOption(
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription(
                "file from which to read the translated unlabelled training set in tabular format (one sentence per line, including id)")
            .isRequired()
            .withLongOpt("unlabelled")
            .create("u"));
    options.addOption(
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription(
                "file from which to read the translated roles (phrase table: source language \\t target language)")
            .isRequired()
            .withLongOpt("roles")
            .create("r"));
    options.addOption(
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription(
                "file in which to write the translated labelled training set in tabular format (aligned with the reference annotation)")
            .isRequired()
            .withLongOpt("output")
            .create("o"));
    options.addOption(
        OptionBuilder.withArgName("int")
            .hasArg()
            .withDescription("example from which to start from")
            .withLongOpt("start")
            .create());

    CommandLineParser parser = new PosixParser();
    CommandLine commandLine = null;

    try {
      commandLine = parser.parse(options, args);

      Properties defaultProps = new Properties();
      try {
        defaultProps.load(new InputStreamReader(new FileInputStream(logConfig), "UTF-8"));
      } catch (Exception e) {
        defaultProps.setProperty("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender");
        defaultProps.setProperty(
            "log4j.appender.stdout.layout.ConversionPattern", "[%t] %-5p (%F:%L) - %m %n");
        defaultProps.setProperty("log4j.appender.stdout.layout", "org.apache.log4j.PatternLayout");
        defaultProps.setProperty("log4j.appender.stdout.Encoding", "UTF-8");
      }

      if (commandLine.hasOption("trace")) {
        defaultProps.setProperty("log4j.rootLogger", "trace,stdout");
      } else if (commandLine.hasOption("debug")) {
        defaultProps.setProperty("log4j.rootLogger", "debug,stdout");
      } else if (commandLine.hasOption("info")) {
        defaultProps.setProperty("log4j.rootLogger", "info,stdout");
      } else {
        if (defaultProps.getProperty("log4j.rootLogger") == null) {
          defaultProps.setProperty("log4j.rootLogger", "info,stdout");
        }
      }
      PropertyConfigurator.configure(defaultProps);

      if (commandLine.hasOption("help") || commandLine.hasOption("version")) {
        throw new ParseException("");
      }

      File labelled = new File(commandLine.getOptionValue("labelled"));
      File unlabelled = new File(commandLine.getOptionValue("unlabelled"));
      File roles = new File(commandLine.getOptionValue("roles"));
      File output = new File(commandLine.getOptionValue("output"));
      try {
        if (commandLine.hasOption("start")) {
          int start = Integer.parseInt(commandLine.getOptionValue("start"));
          new AnnotationMigration(labelled, unlabelled, roles, output, start);
        } else {
          new AnnotationMigration(labelled, unlabelled, roles, output);
        }

      } catch (IOException e) {
        logger.error(e);
      }

    } catch (ParseException exp) {
      if (exp.getMessage().length() > 0) {
        System.err.println("Parsing failed: " + exp.getMessage() + "\n");
      }
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(
          200,
          "java -Dfile.encoding=UTF-8 -cp dist/dirha.jar org.fbk.cit.hlt.dirha.AnnotationMigration",
          "\n",
          options,
          "\n",
          true);
      System.exit(1);
    }
  }
Example #23
0
  public static void main(String[] args) throws Exception {
    String inputFileName = "";
    String inputFileName2 = "";
    String outputFileName = "";
    String solrServerHost = "";
    String keepListFileName = "";
    String filterListFileName = "";
    String searchTerm = "";
    HashMap<String, String> keepGrayList = new HashMap<String, String>();
    HashMap<String, String> filterGrayList = new HashMap<String, String>();
    boolean useAlias = false;

    CommandLineParser parser = new GnuParser();
    Options options = createCLIOptions();
    try {
      CommandLine line = parser.parse(options, args);

      if (line.hasOption("f1")) {
        // get the input file
        inputFileName = line.getOptionValue("f1");
      }
      if (line.hasOption("f2")) {
        inputFileName2 = line.getOptionValue("f2");
      }
      if (line.hasOption("o")) {
        // get the output file
        outputFileName = line.getOptionValue("o");
      }
      if (line.hasOption("s")) {
        // get the server host name
        solrServerHost = line.getOptionValue("s");
      }
      if (line.hasOption("term")) {
        searchTerm = line.getOptionValue("term");
      }
      if (line.hasOption("a")) {
        useAlias = true;
      }
      if (line.hasOption("k")) {
        keepListFileName = line.getOptionValue("k");
      }
      if (line.hasOption("r")) {
        filterListFileName = line.getOptionValue("r");
      }
    } catch (ParseException exp) {
      log.warning("Command line parsing failed.  Reason:" + exp.getMessage());
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("pubcrawl", options);
      System.exit(1);
    }

    if (isEmpty(outputFileName) || isEmpty(inputFileName) && isEmpty(searchTerm)) {
      // missing required elements, print usage and exit
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("pubcrawl", options);
      System.exit(1);
    }

    if (!isEmpty(keepListFileName)) {
      // need to load the keepList hashmap
      FileReader inputReader = new FileReader(keepListFileName);
      BufferedReader bufReader = new BufferedReader(inputReader);
      String keepTerm = bufReader.readLine();
      while (keepTerm != null) {
        String[] keepInfoArr = keepTerm.trim().split("\t");
        keepGrayList.put(keepInfoArr[0].toLowerCase(), keepInfoArr[1]);
        keepTerm = bufReader.readLine();
      }
      bufReader.close();
    }

    log.info("loading filterlist filename");
    if (!isEmpty(filterListFileName)) {
      // need to load the filterlist hashmap
      FileReader inputReader = new FileReader(filterListFileName);
      BufferedReader bufReader = new BufferedReader(inputReader);
      String filterTerm = bufReader.readLine();
      while (filterTerm != null) {
        String[] filterInfoArr = filterTerm.trim().split("\t");
        filterGrayList.put(filterInfoArr[0].toLowerCase(), filterInfoArr[1]);
        filterTerm = bufReader.readLine();
      }
      bufReader.close();
    }

    SolrServer server = getSolrServer(solrServerHost);

    String logname = outputFileName + "_log.out";
    // create output files
    FileWriter logFileStream = new FileWriter(logname);
    BufferedWriter logFileOut = new BufferedWriter(logFileStream);
    FileWriter dataResultsStream = new FileWriter(outputFileName);
    BufferedWriter dataResultsOut = new BufferedWriter(dataResultsStream);

    final Map<String, Integer> singleCountMap = new HashMap<String, Integer>();
    final List<String> term2List = new ArrayList<String>();

    // now load the appropriate list of gene terms  - if the second file name wasn't entered
    if (isEmpty(inputFileName2)) {
      String sql = "Select term1,count from singletermcount";
      if (useAlias) {
        sql = "Select alias,count from singletermcount_alias";
      }

      JdbcTemplate jdbcTemplate = getJdbcTemplate();
      jdbcTemplate.query(
          sql,
          new ResultSetExtractor() {
            public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
              while (rs.next()) {
                String geneName = rs.getString(1).trim();
                int count = rs.getInt(2);
                singleCountMap.put(geneName.toLowerCase(), count);
                if (count > 0) {
                  term2List.add(geneName.toLowerCase());
                }
              }
              return null;
            }
          });
    } else { // have a second input file, so read the file in and put those as the terms in the
             // term2List, set the SingleCountMap to empty
      FileReader inputReader2 = new FileReader(inputFileName2);
      BufferedReader bufReader2 = new BufferedReader(inputReader2);
      String searchTerm2 = bufReader2.readLine();
      while (searchTerm2 != null) {
        term2List.add(searchTerm2.trim().toLowerCase());
        searchTerm2 = bufReader2.readLine();
      }
    }

    Long totalDocCount = getTotalDocCount(server);
    logFileOut.write("Total doc count: " + totalDocCount);
    Pubcrawl p = new Pubcrawl();
    if (isEmpty(inputFileName)) { // entered term option, just have one to calculate
      SearchTermAndList searchTermArray = getTermAndTermList(searchTerm.trim(), useAlias, false);
      Long searchTermCount =
          getTermCount(server, singleCountMap, searchTermArray, filterGrayList, keepGrayList);

      ExecutorService pool = Executors.newFixedThreadPool(32);
      Set<Future<NGDItem>> set = new HashSet<Future<NGDItem>>();
      Date firstTime = new Date();

      for (String secondTerm : term2List) {
        SearchTermAndList secondTermArray = getTermAndTermList(secondTerm, useAlias, false);
        long secondTermCount =
            getTermCount(server, singleCountMap, secondTermArray, filterGrayList, keepGrayList);
        Callable<NGDItem> callable =
            p
            .new SolrCallable(
                searchTermArray,
                secondTermArray,
                searchTermCount,
                secondTermCount,
                server,
                useAlias,
                filterGrayList,
                keepGrayList,
                totalDocCount);
        Future<NGDItem> future = pool.submit(callable);
        set.add(future);
      }

      for (Future<NGDItem> future : set) {
        dataResultsOut.write(future.get().printItem());
      }

      Date secondTime = new Date();
      logFileOut.write(
          "First set of queries took "
              + (secondTime.getTime() - firstTime.getTime()) / 1000
              + " seconds.\n");
      logFileOut.flush();
      logFileOut.close();
      dataResultsOut.flush();
      dataResultsOut.close();
      pool.shutdown();

    } else {

      FileReader inputReader = new FileReader(inputFileName);
      BufferedReader bufReader = new BufferedReader(inputReader);
      String fileSearchTerm = bufReader.readLine();
      SearchTermAndList searchTermArray = getTermAndTermList(fileSearchTerm, useAlias, false);
      Long searchTermCount =
          getTermCount(server, singleCountMap, searchTermArray, filterGrayList, keepGrayList);

      // do this once with a lower amount of threads, in case we are running on a server where new
      // caching is taking place
      ExecutorService pool = Executors.newFixedThreadPool(32);
      List<Future<NGDItem>> set = new ArrayList<Future<NGDItem>>();
      long firstTime = currentTimeMillis();
      int count = 0;

      for (String secondTerm : term2List) {
        count++;
        SearchTermAndList secondTermArray = getTermAndTermList(secondTerm, useAlias, false);
        long secondTermCount =
            getTermCount(server, singleCountMap, secondTermArray, filterGrayList, keepGrayList);
        Callable<NGDItem> callable =
            p
            .new SolrCallable(
                searchTermArray,
                secondTermArray,
                searchTermCount,
                secondTermCount,
                server,
                useAlias,
                filterGrayList,
                keepGrayList,
                totalDocCount);
        Future<NGDItem> future = pool.submit(callable);
        set.add(future);

        if (count > 5000) {
          for (Future<NGDItem> futureItem : set) {
            dataResultsOut.write(futureItem.get().printItem());
            futureItem = null;
          }
          count = 0;
          set.clear();
        }
      }

      for (Future<NGDItem> future : set) {
        dataResultsOut.write(future.get().printItem());
      }

      long secondTime = currentTimeMillis();
      logFileOut.write(
          "First set of queries took " + (secondTime - firstTime) / 1000 + " seconds.\n");
      logFileOut.flush();
      set.clear();

      pool = Executors.newFixedThreadPool(32);
      fileSearchTerm = bufReader.readLine();
      count = 0;
      while (fileSearchTerm != null) {
        searchTermArray = getTermAndTermList(fileSearchTerm, useAlias, false);
        searchTermCount =
            getTermCount(server, singleCountMap, searchTermArray, filterGrayList, keepGrayList);
        secondTime = currentTimeMillis();
        for (String secondTerm : term2List) {
          SearchTermAndList secondTermArray = getTermAndTermList(secondTerm, useAlias, false);
          long secondTermCount =
              getTermCount(server, singleCountMap, secondTermArray, filterGrayList, keepGrayList);
          Callable<NGDItem> callable =
              p
              .new SolrCallable(
                  searchTermArray,
                  secondTermArray,
                  searchTermCount,
                  secondTermCount,
                  server,
                  useAlias,
                  filterGrayList,
                  keepGrayList,
                  totalDocCount);
          Future<NGDItem> future = pool.submit(callable);
          set.add(future);
          count++;
          if (count > 5000) {
            for (Future<NGDItem> futureItem : set) {
              dataResultsOut.write(futureItem.get().printItem());
              futureItem = null;
            }
            count = 0;
            set.clear();
          }
        }

        for (Future<NGDItem> future : set) {
          dataResultsOut.write(future.get().printItem());
          future = null;
        }

        logFileOut.write("Query took " + (currentTimeMillis() - secondTime) / 1000 + " seconds.\n");
        logFileOut.flush();
        set.clear();
        fileSearchTerm = bufReader.readLine();
      }

      long fourthTime = currentTimeMillis();
      logFileOut.write("Final time: " + (fourthTime - firstTime) / 1000 + " seconds.\n");
      bufReader.close();
      logFileOut.flush();
      logFileOut.close();
      dataResultsOut.flush();
      dataResultsOut.close();
      pool.shutdown();
    }
    System.exit(0);
  }
  public static void main(String[] args) {

    Option cacheOpt =
        OptionBuilder.withArgName("cache")
            .hasArgs()
            .withDescription(
                "Type of cache. One of DirectMapped, FullyAssociative, NWaySetAssociative")
            .isRequired()
            .create("cache");
    Option blocksOpt =
        OptionBuilder.withArgName("blocks")
            .hasArg()
            .isRequired()
            .withDescription("The number of blocks in the cache")
            .create("blocks");
    Option linesizeOpt =
        OptionBuilder.withArgName("linesize")
            .hasArg()
            .isRequired()
            .withDescription("")
            .create("linesize");
    Option assocOpt =
        OptionBuilder.withArgName("ways")
            .hasArg()
            .withDescription(
                "Number of ways of the cache. Ignored for a direct mapped cache and a fully associative cache.")
            .create("ways");
    Option patternOpt =
        OptionBuilder.withArgName("pattern")
            .hasArg()
            .isRequired()
            .withDescription(
                "Address pattern to simulate. Can by one of rowMajor, columnMajor, matrixMultiply or matrixTiledMultiply")
            .create("pattern");
    Option bAddressOpt =
        OptionBuilder.withArgName("Bstartaddress")
            .hasArg()
            .withDescription(
                "Start address of array B. If not set, a default, sensible value is used. Only works for rowMajor and columnMajor.")
            .create("Bstartaddress");

    Options options = new Options();
    options.addOption(cacheOpt);
    options.addOption(blocksOpt);
    options.addOption(linesizeOpt);
    options.addOption(assocOpt);
    options.addOption(patternOpt);
    options.addOption(bAddressOpt);

    HelpFormatter formatter = new HelpFormatter();

    CommandLineParser parser = new GnuParser();
    CommandLine line = null;
    try {
      line = parser.parse(options, args);
    } catch (ParseException exp) {
      System.err.println("Parsing of the command line has failed. Here's why: ");
      System.err.println(exp.getMessage());
      formatter.printHelp("CacheSim", options);
      System.exit(-1);
    }

    // The cache should be one of the specified types.
    Cache cache = null;
    try {
      int blocks = Integer.parseInt(line.getOptionValue("blocks"));
      int linesize = Integer.parseInt(line.getOptionValue("linesize"));
      if (!isPowerOf2(blocks) || !isPowerOf2(linesize)) {
        throw new OptionError("Whoops. blocks and linesize must be powers of 2.");
      }
      String ctype = line.getOptionValue("cache");
      if (ctype.equals("DirectMapped")) {
        cache = new DirectMappedCache(blocks, linesize);
      } else if (ctype.equals("FullyAssociative")) {
        cache = new FullyAssociativeCache(blocks, linesize);
      } else if (ctype.equals("NWaySetAssociative")) {
        int assoc = Integer.parseInt(line.getOptionValue("ways"));
        if (blocks % assoc != 0) {
          throw new OptionError(
              "Whoops. blocks should be a multiple of the associativity in a n-way set associative cache");
        }
        cache = new NWayAssociativeCache(blocks / assoc, linesize, assoc);
      } else {
        throw new OptionError("Unknown cache type.");
      }

      String pattern = line.getOptionValue("pattern");

      boolean b_start_address_set = line.hasOption("Bstartaddress");
      int b_start_address = 0;
      if (b_start_address_set) {
        b_start_address = Integer.parseInt(line.getOptionValue("Bstartaddress"));

        if (!pattern.equals("rowMajor") && !pattern.equals("columnMajor")) {
          throw new OptionError(
              "the option Bstartaddress is only supported for the patterns rowMajor and columnMajor");
        }
      }

      if (pattern.equals("rowMajor")) {
        rowMajor(cache, 8, b_start_address_set, b_start_address);
      } else if (pattern.equals("columnMajor")) {
        columnMajor(cache, 8, b_start_address_set, b_start_address);
      } else if (pattern.equals("matrixMultiply")) {
        matrixMultiply(cache, 8);
      } else if (pattern.equals("matrixTiledMultiply")) {
        matrixTiledMultiply(cache, 8);
      } else {
        throw new OptionError("Unknown pattern type.");
      }
    } catch (OptionError exp) {
      System.err.println(exp.getMessage());
      exp.printStackTrace();
      formatter.printHelp("CacheSim", options);
      System.exit(-1);
    }
  }
Example #25
0
 public void printHelp(final String applicationName) {
   final HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(applicationName + " [options]", options);
 }
Example #26
0
 private static void printHelp() {
   HelpFormatter helpFormatter = new HelpFormatter();
   helpFormatter.printHelp("testHelper", createOptions());
 }
Example #27
0
  @SuppressWarnings("unchecked")
  public static void main(String... args) throws ParseException, JoranException, IOException {
    Parser parser = new BasicParser();
    CommandLine cl = null;
    try {
      cl = parser.parse(OPTS, args);
    } catch (ParseException e) {
      HelpFormatter help = new HelpFormatter();
      help.printHelp("dlog", OPTS, true);
      System.exit(-1);
    }

    LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
    loggerContext.reset();

    if (cl.hasOption("config")) {
      // Read Logback configuration
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(loggerContext);

      configurator.doConfigure(cl.getOptionValue("file", "logback.xml"));

      StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
    } else {
      BasicConfigurator.configure(loggerContext);
    }

    Appender appender = null;
    if (cl.hasOption("output")) {
      String outputAppender = cl.getOptionValue("output", "console");
      appender = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME).getAppender(outputAppender);
    }

    ChronicleTools.warmup();
    Chronicle chronicle = new IndexedChronicle(cl.getOptionValue("path"), ChronicleConfig.DEFAULT);
    ExcerptTailer ex = chronicle.createTailer();

    Level level = Level.valueOf(cl.getOptionValue("level", "TRACE"));

    if (cl.hasOption("head")) {
      int lines = Integer.parseInt(cl.getOptionValue("head", "10"));
      for (int i = 0; i < lines; i++) {
        LoggingEvent evt = readLoggingEvent(ex, loggerContext);
        if (evt.getLevel().isGreaterOrEqual(level)) {
          writeEvent(evt, appender);
        }
      }
    } else if (cl.hasOption("tail")) {
      int lines = Integer.parseInt(cl.getOptionValue("tail", "10"));
      Queue<LoggingEvent> tail = new LinkedBlockingQueue<LoggingEvent>(lines);
      while (ex.nextIndex()) {
        LoggingEvent evt = readLoggingEvent(ex, loggerContext);
        if (!tail.offer(evt)) {
          tail.poll();
          tail.add(evt);
        }
      }
      LoggingEvent evt;
      while (null != (evt = tail.poll())) {
        if (evt.getLevel().isGreaterOrEqual(level)) {
          writeEvent(evt, appender);
        }
      }
    } else if (cl.hasOption("search")) {
      String regex = cl.getOptionValue("search");
      Pattern regexPatt = Pattern.compile(regex);
      while (ex.nextIndex()) {
        LoggingEvent evt = readLoggingEvent(ex, loggerContext);
        if (null != evt && evt.getLevel().isGreaterOrEqual(level)) {
          if (regexPatt.matcher(evt.getFormattedMessage()).matches()) {
            writeEvent(evt, appender);
          }
        }
      }
    }

    loggerContext.stop();
    chronicle.close();
  }
Example #28
0
  public void test27635() {
    Option help = new Option("h", "help", false, "print this message");
    Option version = new Option("v", "version", false, "print version information");
    Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");
    Option trackerRun =
        new Option("t", "tracker", false, "Create NLT cache entries only for tracker items");

    Option timeLimit =
        OptionBuilder.withLongOpt("limit")
            .hasArg()
            .withValueSeparator()
            .withDescription("Set time limit for execution, in mintues")
            .create("l");

    Option age =
        OptionBuilder.withLongOpt("age")
            .hasArg()
            .withValueSeparator()
            .withDescription("Age (in days) of cache item before being recomputed")
            .create("a");

    Option server =
        OptionBuilder.withLongOpt("server")
            .hasArg()
            .withValueSeparator()
            .withDescription("The NLT server address")
            .create("s");

    Option numResults =
        OptionBuilder.withLongOpt("results")
            .hasArg()
            .withValueSeparator()
            .withDescription("Number of results per item")
            .create("r");

    Option configFile =
        OptionBuilder.withLongOpt("config")
            .hasArg()
            .withValueSeparator()
            .withDescription("Use the specified configuration file")
            .create();

    Options mOptions = new Options();
    mOptions.addOption(help);
    mOptions.addOption(version);
    mOptions.addOption(newRun);
    mOptions.addOption(trackerRun);
    mOptions.addOption(timeLimit);
    mOptions.addOption(age);
    mOptions.addOption(server);
    mOptions.addOption(numResults);
    mOptions.addOption(configFile);

    HelpFormatter formatter = new HelpFormatter();
    final String EOL = System.getProperty("line.separator");
    StringWriter out = new StringWriter();
    formatter.printHelp(
        new PrintWriter(out), 80, "commandline", "header", mOptions, 2, 2, "footer", true);
    assertEquals(
        "usage: commandline [-a <arg>] [--config <arg>] [-h] [-l <arg>] [-n] [-r <arg>]"
            + EOL
            + "       [-s <arg>] [-t] [-v]"
            + EOL
            + "header"
            + EOL
            + "  -a,--age <arg>      Age (in days) of cache item before being recomputed"
            + EOL
            + "     --config <arg>   Use the specified configuration file"
            + EOL
            + "  -h,--help           print this message"
            + EOL
            + "  -l,--limit <arg>    Set time limit for execution, in mintues"
            + EOL
            + "  -n,--new            Create NLT cache entries only for new items"
            + EOL
            + "  -r,--results <arg>  Number of results per item"
            + EOL
            + "  -s,--server <arg>   The NLT server address"
            + EOL
            + "  -t,--tracker        Create NLT cache entries only for tracker items"
            + EOL
            + "  -v,--version        print version information"
            + EOL
            + "footer"
            + EOL,
        out.toString());
  }
Example #29
0
 public static void displayHelp(final Options options) {
   final HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(80, "groovyc [options] <source-files>", "options:", options, "");
 }
 private static void usage(Options options) {
   HelpFormatter formatter = new HelpFormatter();
   formatter.printHelp(120, SNAAServer.class.getCanonicalName(), null, options, null);
   System.exit(1);
 }