Package org.kohsuke.args4j

Examples of org.kohsuke.args4j.CmdLineParser.parseArgument()


    ExmlConfiguration config = new ExmlConfiguration();

    CmdLineParser parser = new CmdLineParser(config);
    try {
      // parse the arguments.
      parser.parseArgument(args);
    } catch (CmdLineException e) {
      StringBuilder msg = extendedUsage(parser, e);
      throw new CommandLineParseException(msg.toString(), -1);
    }
    return parseConfig(parser, config);
View Full Code Here


  @Test(expected = CmdLineException.class)
  public void testDirectoryDoesNotExists() throws Exception {
    SourceFilesValueHolder holder = new SourceFilesValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);
    parser.parseArgument("xyz");
  }

  @Test
  public void testWithOneDirectory() throws Exception {
    SourceFilesValueHolder holder = new SourceFilesValueHolder();
View Full Code Here

  @Test
  public void testWithOneDirectory() throws Exception {
    SourceFilesValueHolder holder = new SourceFilesValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);
    parser.parseArgument(outputFolder.getRoot().toString());
    assertEquals("One folder", 1, holder.sourcePath.size());
  }

  @Test
  public void testWithMoreDirectories() throws Exception {
View Full Code Here

    File one = outputFolder.newFile("one");
    File two = outputFolder.newFile("two");
    File three = outputFolder.newFile("three");

    parser.parseArgument(one.getAbsolutePath(), two.getAbsolutePath(), three.getAbsolutePath());

    assertEquals("three files", 3, holder.sourcePath.size());
  }
}
View Full Code Here

  @Test(expected = CmdLineException.class)
  public void testDirectoryDoesNotExists() throws Exception {
    PathValueHolder holder = new PathValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);
    parser.parseArgument("xyz");
  }

  @Test
  public void testWithOneDirectory() throws Exception {
    PathValueHolder holder = new PathValueHolder();
View Full Code Here

  @Test
  public void testWithOneDirectory() throws Exception {
    PathValueHolder holder = new PathValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);
    parser.parseArgument(outputFolder.getRoot().toString());
    assertEquals("One folder", 1, holder.sourcePath.size());
  }

  @Test
  public void testWithNull() throws Exception {
View Full Code Here

  @Test
  public void testWithNull() throws Exception {
    PathValueHolder holder = new PathValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);
    parser.parseArgument("");
    assertEquals("Empty", 0, holder.sourcePath.size());
  }

  @Test
  public void testWithMoreDirectories() throws Exception {
View Full Code Here

    File two = outputFolder.newFile("two");
    File three = outputFolder.newFile("three");

    String arg = one.getAbsolutePath() + File.pathSeparator + two.getAbsolutePath() + File.pathSeparator + three.getAbsolutePath();

    parser.parseArgument(arg);

    assertEquals("three files", 3, holder.sourcePath.size());
  }
}
View Full Code Here

  public static void main(String[] args) throws SAXParseException, IOException {
    Gedcom2Gedcomx converter = new Gedcom2Gedcomx();
    CmdLineParser parser = new CmdLineParser(converter);
    try {
      parser.parseArgument(args);
      converter.doMain(parser);
    }
    catch (CmdLineException e) {
      System.err.println(e.getMessage());
      parser.printUsage(System.err);
View Full Code Here

        System.exit(1);
    }
       
        try
        {
          parser.parseArgument(args);
          bean.run();
        } catch (CmdLineException e)
        {
          // * Handling of wrong arguments
          System.err.println(e.getMessage());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.