Package org.apache.commons.cli

Examples of org.apache.commons.cli.Parser


        false,
        "\"n1=v1,n2=v2,..\" (Deprecated) Optional. Add or override a JobConf property.",
        "key=val");

    cli.addOption("program", false, "URI to application executable", "class");
    Parser parser = cli.createParser();
    try {

      // check generic arguments -conf
      GenericOptionsParser genericParser = new GenericOptionsParser(getConf(),
          args);
      // get other arguments
      CommandLine results = parser.parse(cli.options,
          genericParser.getRemainingArgs());

      BSPJob job = new BSPJob(getConf());

      if (results.hasOption("input")) {
View Full Code Here


      options.addOption(option);

    }

    Parser createParser() {
      Parser result = new BasicParser();
      return result;
    }
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

    return name;
  }
 
  public void run(String[] args) {
    try {
      Parser optionParser = new BasicParser();
      CommandLine commandLine;
      try {
        commandLine = optionParser.parse(options, args);
      } catch (ParseException e) {
        throw new ParametersParseException(e);
      }
      if (commandLine.hasOption('h')) {
        printHelp();
View Full Code Here

        opt.addOption("e", "encode", false, "Encode the input");
        opt.addOption("d", "decode", false, "Decode the input (default)");
        opt.addOption("v", "verbose", false
                     ,"Print trace information to stderr");

        Parser parser = new BasicParser();

        try {
            CommandLine cl = parser.parse(opt, args);

            if (cl.hasOption('v')) { // verbose
                beVerbose = true;
            }
            if (cl.hasOption('h')) { // help
View Full Code Here

            // Setup options
            Options options = createOptions();

            // Parse command line
            // GNU parser allow multi-letter short options
            Parser parser = new GnuParser();
            CommandLine cl = null;
            cl = parser.parse(options, args);
            if (cl.hasOption("h")) {
                // automatically generate the help statement
                HelpFormatter formatter = new HelpFormatter();
                formatter.printHelp("BookMaker", options);
                System.exit(0);
View Full Code Here

        false,
        "\"n1=v1,n2=v2,..\" (Deprecated) Optional. Add or override a JobConf property.",
        "key=val");

    cli.addOption("program", false, "URI to application executable", "class");
    Parser parser = cli.createParser();
    try {

      // check generic arguments -conf
      GenericOptionsParser genericParser = new GenericOptionsParser(getConf(),
          args);
      // get other arguments
      CommandLine results = parser.parse(cli.options,
          genericParser.getRemainingArgs());

      BSPJob job = new BSPJob(getConf());

      if (results.hasOption("input")) {
View Full Code Here

      options.addOption(option);

    }

    Parser createParser() {
      Parser result = new BasicParser();
      return result;
    }
View Full Code Here

    cli.addOption("substring", false,
        "The number of chars of the FormatString() to print", "number");
    cli.addOption("count", false, "Report the count only", "number");
    cli.addOption("help", false, "Print out help", "class");

    Parser parser = cli.createParser();

    try {
      HamaConfiguration conf = new HamaConfiguration();

      //GenericOptionsParser genericParser = new GenericOptionsParser(conf, args);

      CommandLine cmdLine = parser.parse(cli.options, args);
      //    genericParser.getRemainingArgs());
      LOG.debug("DEBUG: Arguments: " + args); //genericParser.getRemainingArgs());

      if (cmdLine.hasOption("help")) {
        cli.printUsage();
View Full Code Here

      options.addOption(option);

    }

    Parser createParser() {
      Parser result = new BasicParser();
      return result;
    }
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.