Package com.beust.jcommander

Examples of com.beust.jcommander.JCommander


    System.out.println(sb.toString());
  }

  public static void main(String[] args) throws IOException {
    Params params = new Params();
    JCommander jc = new JCommander(params);
    jc.parse(args);

    Log.setGlobalLogLevel(params.logLevel);

    if (args.length == 0 || params.help) {
      usage(jc);
View Full Code Here


    System.out.println(sb.toString());
  }

  public static void main(String[] args) throws IOException {
    Params params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

  }

  public static void main(String[] args) throws IOException,
      IllegalArgumentException, IllegalAccessException {
    Params params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

    System.out.println(sb.toString());
  }

  public static void main(String[] args) {
    Params params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

  public static void main(String[] args) throws IOException,
      IllegalArgumentException, IllegalAccessException,
      NoSuchAlgorithmException {
    Params params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

  private static Log log = Log.getInstance(CramTools.class);

  public static void main(String[] args) throws Exception {

    Params params = new Params();
    JCommander jc = new JCommander(params);
    jc.setProgramName("cramtools");

    Cram2Bam.Params cram2BamParams = new Cram2Bam.Params();
    Bam2Cram.Params bam2CramParams = new Bam2Cram.Params();
    CramIndexer.Params indexParams = new CramIndexer.Params();
    Merge.Params mergeParams = new Merge.Params();

    jc.addCommand(CRAM2BAM_COMMAND, cram2BamParams);
    jc.addCommand(BAM2CRAM_COMMAND, bam2CramParams);
    jc.addCommand(INDEX_COMMAND, indexParams);
    jc.addCommand(MERGE_COMMAND, mergeParams);

    jc.parse(args);

    String command = jc.getParsedCommand();

    if (command == null || params.help) {
      StringBuilder sb = new StringBuilder();
      sb.append("\n");
      jc.usage(sb);

      System.out.println("Version "
          + CramTools.class.getPackage().getImplementationVersion());
      System.out.println(sb.toString());
      return;
View Full Code Here

public class CommandTest {
  @Test
  public void namedCommandTest1() {
    CommandMain cm = new CommandMain();
    JCommander jc = new JCommander(cm);
    NamedCommandAdd add = new NamedCommandAdd();
    jc.addCommand(add);
    CommandCommit commit = new CommandCommit();
    jc.addCommand("commit", commit);
    jc.parse("add", "-i", "A.java");

    Assert.assertEquals(jc.getParsedCommand(), "add");
    Assert.assertEquals(add.interactive.booleanValue(), true);
    Assert.assertEquals(add.patterns, Arrays.asList("A.java"));
  }
View Full Code Here

  }

  @Test(expectedExceptions = ParameterException.class)
  public void shouldComplainIfNoAnnotations() {
    CommandMain cm = new CommandMain();
    JCommander jc = new JCommander(cm);
    CommandAdd add = new CommandAdd();
    jc.addCommand(add);
  }
View Full Code Here

  }

  @Test
  public void commandTest1() {
    CommandMain cm = new CommandMain();
    JCommander jc = new JCommander(cm);
    CommandAdd add = new CommandAdd();
    jc.addCommand("add", add);
    CommandCommit commit = new CommandCommit();
    jc.addCommand("commit", commit);
    jc.parse("add", "-i", "A.java");

    Assert.assertEquals(jc.getParsedCommand(), "add");
    Assert.assertEquals(add.interactive.booleanValue(), true);
    Assert.assertEquals(add.patterns, Arrays.asList("A.java"));
  }
View Full Code Here

  }

  @Test
  public void commandTest2() {
    CommandMain cm = new CommandMain();
    JCommander jc = new JCommander(cm);
    CommandAdd add = new CommandAdd();
    jc.addCommand("add", add);
    CommandCommit commit = new CommandCommit();
    jc.addCommand("commit", commit);
    jc.parse("-v", "commit", "--amend", "--author=cbeust", "A.java", "B.java");

//    jc.setProgramName("TestCommander");
//    jc.usage();
//    jc.usage("add");
//    jc.usage("commit");

    Assert.assertTrue(cm.verbose);
    Assert.assertEquals(jc.getParsedCommand(), "commit");
    Assert.assertTrue(commit.amend);
    Assert.assertEquals(commit.author, "cbeust");
    Assert.assertEquals(commit.files, Arrays.asList("A.java", "B.java"));
  }
View Full Code Here

TOP

Related Classes of com.beust.jcommander.JCommander

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.