Package org.apache.commons.cli

Examples of org.apache.commons.cli.Parser


  }
 
  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

    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

    }
   
  }
 
  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

    Options opts = new Options();
   
    opts.addOption(usernameOpt);
    opts.addOption(passwordOpt);
   
    Parser p = new BasicParser();
    CommandLine cl = null;
    try {
      cl = p.parse(opts, args);
    } catch (ParseException e1) {
      System.out.println("Parse Exception, exiting.");
      return;
    }
    credentials = new AuthInfo(cl.getOptionValue("username", "root"), ByteBuffer.wrap(cl.getOptionValue("password", "secret").getBytes()), HdfsZooInstance
View Full Code Here

      }
    }
  }
 
  public int run(String[] unprocessed_args) throws Exception {
    Parser p = new BasicParser();
   
    CommandLine cl = p.parse(opts, unprocessed_args);
    String[] args = cl.getArgs();
   
    String username = cl.getOptionValue(usernameOpt.getOpt(), "root");
    String password = cl.getOptionValue(passwordOpt.getOpt(), "secret");
   
View Full Code Here

    Option debugOpt = new Option("d", "debug", false, "enable debug output");
    debugOpt.setRequired(false);
    sentryOptions.addOption(debugOpt);

    try {
      Parser parser = new GnuParser();
      CommandLine cmd = parser.parse(sentryOptions, args);

      for (Option opt : cmd.getOptions()) {
        if (opt.getOpt().equals("s")) {
          setSentrySiteFile(opt.getValue());
        } else if (opt.getOpt().equals("i")) {
View Full Code Here

                .create('D'));

        // [-h|--help]
        options.addOption(new Option("h", "help", false, "Print help information"));

        Parser parser = new GnuParser();
        CommandLine cmdLine = null;

        try {
            cmdLine = parser.parse(options, args);

        } catch (ParseException e) {
            printUsage(options, ss.err);
            System.exit(1);
        }
View Full Code Here

       
        Options options = new Options();
        options.addOption("p", "product", true, "Class name of the product to use for benchmark");
        options.addOption("n", true, "Number of repetitions");
       
        Parser parser = new PosixParser();
        try {
            CommandLine commandLine = parser.parse(options, args);
            if (commandLine.hasOption('p')) {
                product = (Product)Class.forName(commandLine.getOptionValue('p')).newInstance();
            }
            if (commandLine.hasOption('n')) {
                counter = Integer.parseInt(commandLine.getOptionValue('n'));
View Full Code Here

            public String toString() {
                return "Initial run deserialization";
            }
        });

        Parser parser = new PosixParser();
        try {
            CommandLine commandLine = parser.parse(options, args);
            String name = null;
            if (commandLine.hasOption('p')) {
                name = commandLine.getOptionValue('p');
            }
            if (name == null || name.equals("DOM")) {
View Full Code Here

TOP

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

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.