Package org.apache.commons.cli

Examples of org.apache.commons.cli.BasicParser


  }
 
  public static void main(String[] args) throws Exception {
    setupOptions();
   
    Parser p = new BasicParser();
    CommandLine cl = null;
   
    try {
      cl = p.parse(opts, args);
    } catch (ParseException e) {
      throw new RuntimeException(e);
    }
    String[] rargs = cl.getArgs();
    if (rargs.length != 1) {
View Full Code Here


    return opts;
  }
 
  public static IngestArgs parseArgs(String args[]) {
   
    Parser p = new BasicParser();
    Options opts = getOptions();
    CommandLine cl;
   
    try {
      cl = p.parse(opts, args);
    } catch (ParseException e) {
      System.out.println("Parse Error, exiting.");
      throw new RuntimeException(e);
    }
   
View Full Code Here

    options.addOption(maxOpt);
    options.addOption(tabletOpt);
    options.addOption(rowPatternOpt);
    CommandLine cl;
    try {
      cl = new BasicParser().parse(options, args);
    } catch (ParseException ex) {
      usage();
      return;
    }
   
View Full Code Here

    String user = null;
    byte[] pass = null;
    boolean force = false;
   
    try {
      cl = new BasicParser().parse(opts, args);
      if (cl.hasOption("?"))
        throw new ParseException("help requested");
      args = cl.getArgs();
     
      user = cl.hasOption("u") ? cl.getOptionValue("u") : "root";
View Full Code Here

    assert (last == count);
  }
 
  public static void main(String[] args) throws Exception {
   
    Parser p = new BasicParser();
    CommandLine cl = null;
   
    try {
      cl = p.parse(opts, args);
    } catch (ParseException e) {
      throw new RuntimeException(e);
    }
    String[] rargs = cl.getArgs();
    if (rargs.length != 0) {
View Full Code Here

    Option dumpKeys = new Option("d", "dump", false, "dump the key/value pairs");
    opts.addOption(dumpKeys);
    Option histogramOption = new Option("h", "histogram", false, "print a histogram of the key-value sizes");
    opts.addOption(histogramOption);
   
    CommandLine commandLine = new BasicParser().parse(opts, args);
   
    boolean dump = commandLine.hasOption(dumpKeys.getOpt());
    boolean doHistogram = commandLine.hasOption(histogramOption.getOpt());
    long countBuckets[] = new long[11];
    long sizeBuckets[] = new long[countBuckets.length];
View Full Code Here

    options.addOption("u", "user", true, "user");
    options.addOption("p", "password", true, "password");
    options.addOption("f", "force", false, "merge small tablets even if merging them to larger tablets might cause a split");
    options.addOption("b", "begin", true, "start tablet");
    options.addOption("e", "end", true, "end tablet");
    CommandLine commandLine = new BasicParser().parse(options, args);
    if (commandLine.hasOption("k")) {
      keepers = commandLine.getOptionValue("k");
    }
    if (commandLine.hasOption("i")) {
      instance = commandLine.getOptionValue("i");
View Full Code Here

   
    opts.addOptionGroup(authTimeoutOptions);
   
    CommandLine cl;
    try {
      cl = new BasicParser().parse(opts, args);
      if (cl.getArgs().length > 0)
        throw new ParseException("Unrecognized arguments: " + cl.getArgList());
     
      if (cl.hasOption(helpOpt.getOpt())) {
        configError = true;
View Full Code Here

       
        // Get the options from the command on how to parse the string
        Options parseOpts = sc.getOptionsWithHelp();
       
        // Parse the string using the given options
        CommandLine cl = new BasicParser().parse(parseOpts, fields);
       
        int actualArgLen = cl.getArgs().length;
        int expectedArgLen = sc.numArgs();
        if (cl.hasOption(helpOption)) {
          // Display help if asked to; otherwise execute the command
View Full Code Here

    }
   
  }
 
  public static void main(String[] args) throws Exception {
    Parser p = new BasicParser();
   
    CommandLine cl = null;
    try {
      cl = p.parse(opts, args);
    } catch (ParseException e) {
      System.out.println("Parse Exception, exiting.");
      return;
    }
   
View Full Code Here

TOP

Related Classes of org.apache.commons.cli.BasicParser

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.