예제 #1
1
파일: BugsTest.java 프로젝트: srnsw/xena
  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);
    }
  }
예제 #2
0
  public static void main(String args[]) throws IOException, ParseException {
    Options options = new Options();
    options.addOption("u", "uniquehits", false, "only output hits with a single mapping");
    options.addOption(
        "s",
        "nosuboptimal",
        false,
        "do not include hits whose score is not equal to the best score for the read");
    CommandLineParser parser = new GnuParser();
    CommandLine cl = parser.parse(options, args, false);
    boolean uniqueOnly = cl.hasOption("uniquehits");
    boolean filterSubOpt = cl.hasOption("nosuboptimal");

    ArrayList<String[]> lines = new ArrayList<String[]>();

    String line;
    String lastRead = "";
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    while ((line = reader.readLine()) != null) {
      String pieces[] = line.split("\t");
      if (!pieces[0].equals(lastRead)) {
        printLines(lines, uniqueOnly, filterSubOpt);
        lines.clear();
      }
      lines.add(pieces);
      lastRead = pieces[0];
    }
    printLines(lines, uniqueOnly, filterSubOpt);
  }
예제 #3
0
  public void run(String[] args)
      throws ParseException, TransformationException, IOException, AnalysisException {
    Options options = new Options();
    options.addOption("input", true, "input path");
    options.addOption("output", true, "output path");
    options.addOption("ext", true, "extension");
    CommandLineParser parser = new DefaultParser();
    CommandLine line = parser.parse(options, args);
    String inDir = line.getOptionValue("input");
    String outDir = line.getOptionValue("output");
    String extension = line.getOptionValue("ext");

    File dir = new File(inDir);

    for (File f : FileUtils.listFiles(dir, new String[] {extension}, true)) {
      TrueVizToBxDocumentReader tvReader = new TrueVizToBxDocumentReader();
      List<BxPage> pages = tvReader.read(new FileReader(f));
      BxDocument doc = new BxDocument().setPages(pages);
      doc.setFilename(f.getName());

      BxDocument rewritten = transform(doc);

      File f2 = new File(outDir + doc.getFilename());
      BxDocumentToTrueVizWriter wrt = new BxDocumentToTrueVizWriter();
      boolean created = f2.createNewFile();
      if (!created) {
        throw new IOException("Cannot create file: ");
      }
      FileWriter fw = new FileWriter(f2);
      wrt.write(fw, Lists.newArrayList(rewritten));
      fw.flush();
      fw.close();
    }
  }
예제 #4
0
  public static Options constructGnuOptions() {
    final Options gnuOptions = new Options();
    Option aminoDefaultConfigurationOption =
        new Option(
            "d", "amino_default_config_path", true, "The path where the amino default file lives.");
    aminoDefaultConfigurationOption.setRequired(true);
    gnuOptions.addOption(aminoDefaultConfigurationOption);
    gnuOptions.addOption("b", "base_dir", true, "The base directory of the running job");
    gnuOptions.addOption(
        "c",
        "amino_config_file_path",
        true,
        "A CSV of filenames or paths which will be acted like a classpath setting up configurations!");
    gnuOptions.addOption(
        "stop",
        "stop_on_first_phase",
        false,
        "Stop after the first phase of an AminoEnrichmentJob");

    Option propertyOverride =
        new Option(
            "D",
            "property_override",
            true,
            "A map of key/value configuration properties to override (ie: 'key=value')");
    propertyOverride.setValueSeparator('=');
    propertyOverride.setArgs(2);
    gnuOptions.addOption(propertyOverride);

    return gnuOptions;
  }
예제 #5
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);
  }
예제 #6
0
파일: BugsTest.java 프로젝트: srnsw/xena
  public void test11456() {
    // Posix
    Options options = new Options();
    options.addOption(OptionBuilder.hasOptionalArg().create('a'));
    options.addOption(OptionBuilder.hasArg().create('b'));
    String[] args = new String[] {"-a", "-bvalue"};

    CommandLineParser parser = new PosixParser();

    try {
      CommandLine cmd = parser.parse(options, args);
      assertEquals(cmd.getOptionValue('b'), "value");
    } catch (ParseException exp) {
      fail("Unexpected Exception: " + exp.getMessage());
    }

    // GNU
    options = new Options();
    options.addOption(OptionBuilder.hasOptionalArg().create('a'));
    options.addOption(OptionBuilder.hasArg().create('b'));
    args = new String[] {"-a", "-b", "value"};

    parser = new GnuParser();

    try {
      CommandLine cmd = parser.parse(options, args);
      assertEquals(cmd.getOptionValue('b'), "value");
    } catch (ParseException exp) {
      fail("Unexpected Exception: " + exp.getMessage());
    }
  }
예제 #7
0
 /** Add the commandline options common to any command */
 static {
   options.addOption("h", "help", false, "print this message");
   options.addOption("p", "project", true, "project name");
   options.addOption("a", "action", true, "action to run {create | remove}");
   options.addOption("v", "verbose", false, "verbose messages");
   options.addOption("G", "cygwin", false, "for create, indicate that the node is using cygwin");
   // options.addOption("N", "nodeslist", true, "Path to arbitrary nodes.properties file");
 }
예제 #8
0
  private static Options createOptions() {
    Options options = new Options();
    options.addOption("h", "help", false, "Prints this message");
    options.addOption("w", "wmprt", true, "Path to WMPRT folder");
    options.addOption("o", "output", true, "Output Folder for generated code");
    options.addOption("n", "namespace", true, "The desired namespace for the generated code");

    return options;
  }
예제 #9
0
 // wrapper function to add an option
 private void addOptionWrapper(Option opt, boolean isStandard) {
   // for parsing command-line options
   options.addOption(opt);
   // for printing help messages
   getOptionList().add(opt);
   if (isStandard) {
     optionsStandard.addOption(opt);
   } else {
     optionsExperimental.addOption(opt);
   }
 }
예제 #10
0
파일: BugsTest.java 프로젝트: srnsw/xena
  public void test12210() {
    // create the main options object which will handle the first parameter
    Options mainOptions = new Options();
    // There can be 2 main exclusive options:  -exec|-rep

    // Therefore, place them in an option group

    String[] argv = new String[] {"-exec", "-exec_opt1", "-exec_opt2"};
    OptionGroup grp = new OptionGroup();

    grp.addOption(new Option("exec", false, "description for this option"));

    grp.addOption(new Option("rep", false, "description for this option"));

    mainOptions.addOptionGroup(grp);

    // for the exec option, there are 2 options...
    Options execOptions = new Options();
    execOptions.addOption("exec_opt1", false, " desc");
    execOptions.addOption("exec_opt2", false, " desc");

    // similarly, for rep there are 2 options...
    Options repOptions = new Options();
    repOptions.addOption("repopto", false, "desc");
    repOptions.addOption("repoptt", false, "desc");

    // create the parser
    GnuParser parser = new GnuParser();

    // finally, parse the arguments:

    // first parse the main options to see what the user has specified
    // We set stopAtNonOption to true so it does not touch the remaining
    // options
    try {
      CommandLine cmd = parser.parse(mainOptions, argv, true);
      // get the remaining options...
      argv = cmd.getArgs();

      if (cmd.hasOption("exec")) {
        cmd = parser.parse(execOptions, argv, false);
        // process the exec_op1 and exec_opt2...
        assertTrue(cmd.hasOption("exec_opt1"));
        assertTrue(cmd.hasOption("exec_opt2"));
      } else if (cmd.hasOption("rep")) {
        cmd = parser.parse(repOptions, argv, false);
        // process the rep_op1 and rep_opt2...
      } else {
        fail("exec option not found");
      }
    } catch (ParseException exp) {
      fail("Unexpected exception: " + exp.getMessage());
    }
  }
예제 #11
0
  private static void parseArguments(String[] args) throws ParseException {
    Options options = new Options();
    options.addOption("input", true, "The input file path");
    options.addOption("output", true, "The output file path");
    options.addOption("threads", true, "The number of threads");

    CommandLine commandLine = new PosixParser().parse(options, args);

    inputFilePath = commandLine.getOptionValue("input", "price_moves.csv");
    outputFilePath = commandLine.getOptionValue("output", "result.txt");
    numberOfThreads = Integer.valueOf(commandLine.getOptionValue("threads", "1"));
  }
예제 #12
0
  /** Method to create command line parser */
  private void createCmdLineParser() {
    cmdOptions = new Options();

    // add a accession option
    cmdOptions.addOption(
        ACCESSION_CMD, true, "a list of pride experiment accessions, separated by comma");
    // add a user name option
    cmdOptions.addOption(USER_NAME_CMD, true, "pride user name");
    // add a password option
    cmdOptions.addOption(PASSWORD_CMD, true, "pride password");
    // create cmd line parser
    cmdParser = new GnuParser();
  }
예제 #13
0
파일: BugsTest.java 프로젝트: srnsw/xena
  public void test15046() throws Exception {
    CommandLineParser parser = new PosixParser();
    final String[] CLI_ARGS = new String[] {"-z", "c"};
    Option option = new Option("z", "timezone", true, "affected option");
    Options cliOptions = new Options();
    cliOptions.addOption(option);
    parser.parse(cliOptions, CLI_ARGS);

    // now add conflicting option
    cliOptions.addOption("c", "conflict", true, "conflict option");
    CommandLine line = parser.parse(cliOptions, CLI_ARGS);
    assertEquals(option.getValue(), "c");
    assertTrue(!line.hasOption("c"));
  }
예제 #14
0
  public static void main(String[] args) throws Exception {

    String propertyFile = null;

    // create the command line parser
    CommandLineParser parser = new PosixParser();
    Options options = new Options();
    options.addOption("f", "file", true, "The properties file");
    options.addOption("v", "verbose", false, "Verbose logging output");
    options.addOption("h", "help", false, "Help output");

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

      if (line.hasOption('v')) {
        org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.DEBUG);
      }

      if (line.hasOption('h')) {
        usage(options);
      }

      if (line.hasOption('f')) {
        propertyFile = line.getOptionValue('f');
      } else {
        throw new Exception("Please supply -f");
      }

    } catch (Exception e) {
      log.error("Invalid command line: " + e, e);
      usage(options);
    }

    Properties props = new Properties();
    props.load(new FileReader(propertyFile));
    startFromProperties(props);

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  @Override
                  public void run() {
                    log.info("Received shutdown signal. Shutting down...");
                    server.stop(3);
                  }
                }));
  }
예제 #15
0
파일: BugsTest.java 프로젝트: srnsw/xena
  public void test13425() {
    Options options = new Options();
    Option oldpass =
        OptionBuilder.withLongOpt("old-password")
            .withDescription("Use this option to specify the old password")
            .hasArg()
            .create('o');
    Option newpass =
        OptionBuilder.withLongOpt("new-password")
            .withDescription("Use this option to specify the new password")
            .hasArg()
            .create('n');

    String[] args = {"-o", "-n", "newpassword"};

    options.addOption(oldpass);
    options.addOption(newpass);

    Parser parser = new PosixParser();

    try {
      CommandLine line = parser.parse(options, args);
    }
    // catch the exception and leave the method
    catch (Exception exp) {
      assertTrue(exp != null);
      return;
    }
    fail("MissingArgumentException not caught.");
  }
예제 #16
0
  public static Options buildCommandLineOptions(final Options options) {
    Option opt = new Option("h", "help", false, "Print help");
    opt.setRequired(false);
    options.addOption(opt);

    opt =
        new Option(
            "n",
            "namesrvAddr",
            true,
            "Name server address list, eg : 192.168.0.1:9876; 192.168.0.2:9876");
    opt.setRequired(false);
    options.addOption(opt);

    return options;
  }
예제 #17
0
/*	public static String optarg; //TODO import gnu.getopt.Getopt; in ginit()
	public static int optind; //TODO import gnu.getopt.Getopt; in ginit();
	//TODO make long_options(struct)
	private static String[] long_options = { "verbose", "verbose:gc", "verbose:sugar", 
								"verbose:code", "interactive", "typecheck", 
								"start-with", "test", "test-with", "builtin-test", "NULL" };
*/	
	static {
		longOptions = new Options();
		longOptions.addOption(null, "verbose", false, null);
		longOptions.addOption(null, "verbose:gc", false, null);
		longOptions.addOption(null, "verbose:sugar", false, null);
		longOptions.addOption(null, "verbose:code", false, null);
		longOptions.addOption("i", "interactive", false, null);
		longOptions.addOption("c", "typecheck", false, null);
		longOptions.addOption("S", "start-with", true, null);
		longOptions.addOption("T", "test", true, null);
		longOptions.addOption("T", "test-with", true, null);
		longOptions.addOption("B", "builtin-test", true, null);
	}
  public void addParameterInfo() {

    /* use Object parameter of Options class to store parameter information */

    parameter.addOption(
        OptionBuilder.withArgName("input VCF file")
            .hasArg()
            .withDescription("Input vcf file containing variation info")
            .create(INPUT_VCF));

    parameter.addOption(
        OptionBuilder.withArgName("input tabular file")
            .hasArg()
            .withDescription("Input tabular file containing variation info")
            .create(INPUT_TAB));

    parameter.addOption(
        OptionBuilder.withArgName("output file")
            .hasArg()
            .withDescription("Output alleles p value")
            .create(OUTPUT_LINE));

    parameter.addOption(
        OptionBuilder.withArgName("Columns for Alleles")
            .hasArg()
            .withDescription("columns where allele info is set")
            .create(COLUMN));

    parameter.addOption(
        OptionBuilder.withArgName("Cache data")
            .hasArg(false)
            .withDescription("weather to cache data in memory or not, default no")
            .create(CACHE));

    parameter.addOption(
        OptionBuilder.withArgName("re-partition num")
            .hasArg()
            .withDescription(
                "even the load of each task, 1 partition for a task or 4 partitions for a task is recommended. Default, not re-partition")
            .create(PARTITIONS));

    parameter.addOption(
        OptionBuilder.hasArg(false).withDescription("show version information").create(VERSION));

    parameter.addOption(
        OptionBuilder.hasArg(false)
            .withDescription("print and show this information")
            .create(HELP));

    parameter.addOption(OptionBuilder.hasArg(false).withDescription("").create(HELP2));
  }
  private void parseArgs(final String[] args) throws ParseException {
    final Options options = new Options();
    options.addOption("c", "claim", false, "Use Try/Claim");
    options.addOption("", "pubChannel", true, "Primary publishing channel");
    options.addOption("", "reflectChannel", true, "Reflection channel");

    final CommandLineParser parser = new GnuParser();
    final CommandLine command = parser.parse(options, args);

    if (command.hasOption("pubChannel")) {
      pubChannel = command.getOptionValue("pubChannel", "udp://localhost:44444");
    }

    if (command.hasOption("reflectChannel")) {
      reflectChannel = command.getOptionValue("reflectChannel", "udp://localhost:55555");
    }
  }
예제 #20
0
파일: BugsTest.java 프로젝트: srnsw/xena
 public void test15648() throws Exception {
   CommandLineParser parser = new PosixParser();
   final String[] args = new String[] {"-m", "\"Two Words\""};
   Option m = OptionBuilder.hasArgs().create("m");
   Options options = new Options();
   options.addOption(m);
   CommandLine line = parser.parse(options, args);
   assertEquals("Two Words", line.getOptionValue("m"));
 }
예제 #21
0
  // TODO add exception for invalid options
  private void loadCLO(String[] args) {
    Options options = new Options();

    String[][] clolist = {
      // {"variable/optionname", "description"},
      {"genConfig", "general configuration file location"},
      {"inWeightsLoc", "input weights configuration file location"},
      {"inDBLoc", "input database file location"},
      {"outWeightsLoc", "output weights configuration file location"},
      {"outDBLoc", "output database file location"},
      {"p3pLocation", "adding to DB: single policy file location"},
      {"p3pDirLocation", "adding to DB: multiple policy directory location"},
      {"newDB", "create new database in place of old one (doesn't check for existence of old one"},
      {"newPolicyLoc", "the policy object to process"},
      {"userResponse", "response to specified policy"},
      {"userIO", "user interface"},
      {"userInit", "initialization via user interface"},
      {"policyDB", "PolicyDatabase backend"},
      {"cbrV", "CBR to use"},
      {"blanketAccept", "automatically accept the user suggestion"},
      {"loglevel", "level of things save to the log- see java logging details"},
      {"policyDB", "PolicyDatabase backend"},
      {"NetworkRType", "Network Resource type"},
      {"NetworkROptions", "Network Resource options"},
      {"confidenceLevel", "Confidence threshold for consulting a networked resource"},
      {"useNet", "use networking options"},
      {"loglocation", "where to save the log file"},
      {"loglevel", "the java logging level to use. See online documentation for enums."}
    };

    for (String[] i : clolist) {
      options.addOption(i[0], true, i[1]);
    }

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = null;
    try {
      cmd = parser.parse(options, args);
    } catch (ParseException e) {
      System.err.println("Error parsing commandline arguments.");
      e.printStackTrace();
      System.exit(3);
    }
    /*
    for(String i : args)
    {
    	System.err.println(i);
    }
    */
    for (String[] i : clolist) {
      if (cmd.hasOption(i[0])) {
        System.err.println("found option i: " + i);
        genProps.setProperty(i[0], cmd.getOptionValue(i[0]));
      }
    }
    System.err.println(genProps);
  }
예제 #22
0
  static Options options() {
    Options options = new Options();
    options.addOption(LIST, false, "List current monitors");
    options.addOption(ALARMS, false, "Show alarms");
    options.addOption(PERIOD, true, "Period to cover when showing alarms");
    options.addOption(THRESHOLD, true, "Minimum duration when showing alarms");
    options.addOption(DELETE, true, "Delete monitor by ID");
    options.addOption(START, false, "Start monitors (use with 'wait' and 'timeout')");
    options.addOption(WAIT, true, "Wait duration in milliseconds between each poll cycle");
    options.addOption(TIMEOUT, true, "Timeout duration in milliseconds for a poll");

    return options;
  }
  protected CommandLine getCommand(String[] args) throws ParseException {
    Options options = new Options();
    Option opt = new Option("maxMaps", true, "max number of maps to use for this copy");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("sourcePaths", true, "comma separtated list of source paths to be copied");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("targetPath", true, "target path");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("falconFeedStorageType", true, "feed storage type");
    opt.setRequired(true);
    options.addOption(opt);

    return new GnuParser().parse(options, args);
  }
예제 #24
0
파일: BugsTest.java 프로젝트: srnsw/xena
  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());
  }
예제 #25
0
파일: BugsTest.java 프로젝트: srnsw/xena
  public void test11680() {
    Options options = new Options();
    options.addOption("f", true, "foobar");
    options.addOption("m", true, "missing");
    String[] args = new String[] {"-f", "foo"};

    CommandLineParser parser = new PosixParser();

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

      try {
        cmd.getOptionValue("f", "default f");
        cmd.getOptionValue("m", "default m");
      } catch (NullPointerException exp) {
        fail("NullPointer caught: " + exp.getMessage());
      }
    } catch (ParseException exp) {
      fail("Unexpected Exception: " + exp.getMessage());
    }
  }
예제 #26
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);
    }
  }
예제 #27
0
파일: BugsTest.java 프로젝트: srnsw/xena
  public void test14786() throws Exception {
    Option o = OptionBuilder.isRequired().withDescription("test").create("test");
    Options opts = new Options();
    opts.addOption(o);
    opts.addOption(o);

    CommandLineParser parser = new GnuParser();

    String[] args = new String[] {"-test"};

    CommandLine line = parser.parse(opts, args);
    assertTrue(line.hasOption("test"));
  }
  private static Options buildOptions() {
    Options options = new Options();

    Option tokenService =
        OptionBuilder.withArgName("service")
            .hasArg()
            .withDescription("set the name of calling service")
            .isRequired()
            .create("service");
    options.addOption(tokenService);

    return options;
  }
예제 #29
0
  public static void main(String[] args) {
    Options options = new Options();
    options.addOption("v", true, "Input Vector folder"); // yearly vector data
    options.addOption("p", true, "Points folder"); // yearly mds (rotate) output
    options.addOption("d", true, "Destination folder");
    options.addOption("o", true, "Original stock file"); // global 10 year stock file
    options.addOption(
        "s",
        true,
        "Sector file"); // If Histogram true then set this as the folder to histogram output
    options.addOption("h", false, "Gen from histogram");
    options.addOption("e", true, "Extra classes file"); // a file containing fixed classes
    options.addOption("ci", true, "Cluster input file");
    options.addOption("co", true, "Cluster output file");

    CommandLineParser commandLineParser = new BasicParser();
    try {
      CommandLine cmd = commandLineParser.parse(options, args);
      String vectorFile = cmd.getOptionValue("v");
      String pointsFolder = cmd.getOptionValue("p");
      String distFolder = cmd.getOptionValue("d");
      String originalStocks = cmd.getOptionValue("o");
      String sectorFile = cmd.getOptionValue("s");
      boolean histogram = cmd.hasOption("h");
      String fixedClasses = cmd.getOptionValue("e");
      String clusterInputFile = cmd.getOptionValue("ci");
      String clusterOutputFile = cmd.getOptionValue("co");

      LabelApply program =
          new LabelApply(
              vectorFile,
              pointsFolder,
              distFolder,
              originalStocks,
              sectorFile,
              histogram,
              fixedClasses,
              clusterInputFile,
              clusterOutputFile);
      program.process();
    } catch (ParseException e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args)
      throws TransformationException, IOException, AnalysisException, ParseException,
          CloneNotSupportedException {
    Options options = new Options();
    options.addOption("input", true, "input path");
    options.addOption("output", true, "output path");
    CommandLineParser parser = new GnuParser();
    CommandLine line = parser.parse(options, args);
    String inDir = line.getOptionValue("input");
    String outDir = line.getOptionValue("output");

    File dir = new File(inDir);

    for (File f : FileUtils.listFiles(dir, new String[] {"xml"}, true)) {
      TrueVizToBxDocumentReader tvReader = new TrueVizToBxDocumentReader();
      List<BxPage> pages = tvReader.read(new FileReader(f));
      BxDocument doc = new BxDocument().setPages(pages);
      doc.setFilename(f.getName());

      int all = 0;
      int good = 0;
      for (BxZone z : doc.asZones()) {
        all++;
        if (!z.getLabel().equals(BxZoneLabel.OTH_UNKNOWN)) {
          good++;
        }
      }
      int intcov = 0;
      if (all > 0) {
        intcov = good * 100 / all;
      }
      System.out.println(doc.getFilename() + " " + intcov);

      File f2 = new File(outDir + doc.getFilename() + "." + intcov);
      FileUtils.copyFile(f, f2);
    }
  }