Package org.kohsuke.args4j

Examples of org.kohsuke.args4j.CmdLineParser


  }

  @Test(expected = CmdLineException.class)
  public void testDirectoryDoesNotExists() throws Exception {
    SourceFilesValueHolder holder = new SourceFilesValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);
    parser.parseArgument("xyz");
  }
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());
  }
View Full Code Here

  }

  @Test
  public void testWithMoreDirectories() throws Exception {
    SourceFilesValueHolder holder = new SourceFilesValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);

    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");
  }
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());
  }
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());
  }
View Full Code Here

  }

  @Test
  public void testWithMoreDirectories() throws Exception {
    PathValueHolder holder = new PathValueHolder();
    CmdLineParser parser = new CmdLineParser(holder);

    File one = outputFolder.newFile("one");
    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

    }

  private static void readArguments(String[] args) throws IOException
  {   
      App bean = new App();
        CmdLineParser parser = new CmdLineParser(bean);
       
    if(args.length == 0)
    {
        parser.printUsage(System.err);
        System.exit(1);
    }
       
        try
        {
          parser.parseArgument(args);
          bean.run();
        } catch (CmdLineException e)
        {
          // * Handling of wrong arguments
          System.err.println(e.getMessage());
          parser.printUsage(System.err);
        }
  }
View Full Code Here

    }

  private static void readArguments(String[] args) throws IOException
  {   
      App bean = new App();
        CmdLineParser parser = new CmdLineParser(bean);
       
    if(args.length == 0)
    {
        parser.printUsage(System.err);
        System.exit(1);
    }
       
        try
        {
          parser.parseArgument(args);
          bean.run();
        } catch (CmdLineException e)
        {
          // * Handling of wrong arguments
          System.err.println(e.getMessage());
          parser.printUsage(System.err);
        }
  }
View Full Code Here

TOP

Related Classes of org.kohsuke.args4j.CmdLineParser

Copyright © 2018 www.massapicom. 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.