Package org.apache.commons.cli

Examples of org.apache.commons.cli.Parser


    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


    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;
    }
   
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"), cl.getOptionValue("password", "secret").getBytes(), HdfsZooInstance.getInstance()
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

    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

        super("sync", "path");
    }

    @Override
    public CliCommand parse(String[] cmdArgs) throws ParseException {
        Parser parser = new PosixParser();
        CommandLine cl = parser.parse(options, cmdArgs);
        args = cl.getArgs();
        if (args.length < 2) {
            throw new ParseException(getUsageStr());
        }
View Full Code Here

        super("removewatches", "path [-c|-d|-a] [-l]");
    }

    @Override
    public CliCommand parse(String[] cmdArgs) throws ParseException {
        Parser parser = new PosixParser();
        cl = parser.parse(options, cmdArgs);
        args = cl.getArgs();
        if (args.length < 2) {
            throw new ParseException(getUsageStr());
        }
        return this;
View Full Code Here

        super(cmdStr, "path");
    }
   
    @Override
    public CliCommand parse(String[] cmdArgs) throws ParseException {
        Parser parser = new PosixParser();
        CommandLine cl = parser.parse(options, cmdArgs);
        args = cl.getArgs();
        if (args.length < 2) {
            throw new ParseException(getUsageStr());
        }
View Full Code Here

        super("getAcl", "[-s] path");
    }

    @Override
    public CliCommand parse(String[] cmdArgs) throws ParseException {
        Parser parser = new PosixParser();
        cl = parser.parse(options, cmdArgs);
        args = cl.getArgs();
        if (args.length < 2) {
            throw new ParseException(getUsageStr());
        }
View Full Code Here

        super("addauth", "scheme auth");
    }

    @Override
    public CliCommand parse(String[] cmdArgs) throws ParseException {
        Parser parser = new PosixParser();
        CommandLine cl = parser.parse(options, cmdArgs);
        args = cl.getArgs();
        if (args.length < 2) {
            throw new ParseException(getUsageStr());
        }
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.