Package com.beust.jcommander

Examples of com.beust.jcommander.JCommander.usage()


    out = new StringBuilder();
    jc.usage("ci", out);
    patternMatchesTimes("commit\\(ci,cmt\\)", out.toString(), 1);

    out = new StringBuilder();
    jc.usage("cmt", out);
    patternMatchesTimes("commit\\(ci,cmt\\)", out.toString(), 1);
  }

  @Test
  public void usageDisplaysCommandWithAliasesOnlyOnce() {
View Full Code Here


    CommandMain cm = new CommandMain();
    JCommander jc = new JCommander(cm);
    CommandCommit commit = new CommandCommit();
    jc.addCommand("commit", commit, "ci", "cmt");
    StringBuilder out = new StringBuilder();
    jc.usage(out);
    // The usage should display this string twice: one as the command name
    // and one after Usage:
    patternMatchesTimes("commit\\(ci,cmt\\)", out.toString(), 2);
  }
View Full Code Here

    CommandAdd add = new CommandAdd();
    jc.addCommand("add", add, "a");
    CommandCommit commit = new CommandCommit();
    jc.addCommand("commit", commit, "ci", "cmt");
    StringBuilder sb = new StringBuilder();
    jc.usage(sb);
    System.out.println("--- usage() formatting ---");
    System.out.println(sb.toString());

    sb = new StringBuilder();
    jc.usage("commit", sb);
View Full Code Here

    jc.usage(sb);
    System.out.println("--- usage() formatting ---");
    System.out.println(sb.toString());

    sb = new StringBuilder();
    jc.usage("commit", sb);
    System.out.println("--- usage('commit') formatting ---");
    System.out.println(sb.toString());
  }

  private void patternMatchesTimes(String pattern, String input, int times) {
View Full Code Here

      }

      if (help) {
        String cmd = parser.getParsedCommand();
        if (cmd == null) {
          parser.usage();
        }
        else {
          parser.usage(cmd);
        }             
      }
View Full Code Here

        String cmd = parser.getParsedCommand();
        if (cmd == null) {
          parser.usage();
        }
        else {
          parser.usage(cmd);
        }             
      }
      else {
       
        Runnable cmd = commands.get(parser.getParsedCommand());
View Full Code Here

      for(String m: error.messages) {
        logError(m);
      }
      if (error.printUsage && parser != null) {
        if (parser.getParsedCommand() != null) {
          parser.usage(parser.getParsedCommand());
        }
        else {
          parser.usage();
        }
      }
View Full Code Here

      if (error.printUsage && parser != null) {
        if (parser.getParsedCommand() != null) {
          parser.usage(parser.getParsedCommand());
        }
        else {
          parser.usage();
        }
      }
    }
    catch(Throwable e) {
      e.printStackTrace();
View Full Code Here

    StopMasterCommand stopMasterOpts = new StopMasterCommand();
    cl.addCommand("stopMaster", stopMasterOpts);
    cl.parse(args);

    if (opts.help || cl.getParsedCommand() == null) {
      cl.usage();
      return;
    }
    Instance instance = opts.getInstance();

    try {
View Full Code Here

    jc.addCommand("fail", new FailOpts());
    jc.addCommand("delete", new DeleteOpts());
    jc.addCommand("print", new PrintOpts());
    jc.parse(args);
    if (opts.help || jc.getParsedCommand() == null) {
      jc.usage();
      System.exit(1);
    }

    System.err
        .printf("This tool has been deprecated%nFATE administration now available within 'accumulo shell'%n$ fate fail <txid>... | delete <txid>... | print [<txid>...]%n%n");
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.