Package org.apache.commons.cli

Examples of org.apache.commons.cli.Parser


        .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


            .withDescription("Wait on keyboard input after commit & batch close. default: disabled")
            .withLongOpt("pause")
            .create('x'));


    Parser parser = new GnuParser();
    CommandLine cmdline = null;
    try {
      cmdline = parser.parse(options, args);
    } catch (ParseException e) {
      System.err.println(e.getMessage());
      usage(options);
    }
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, System.err);
      // Note, we print to System.err instead of ss.err, because if we can't parse our
      // commandline, we haven't even begun, and therefore cannot be expected to have
View Full Code Here

        // make the filteredArgList into an array
        String[] filterArgs = new String[filteredArgList.size()];
        filteredArgList.toArray(filterArgs);

        // parse the command line
        Parser parser = new GnuParser();
        return parser.parse(cmdLineOptions, filterArgs);
    }
View Full Code Here

  private void process(String[] args) {
    String ctxName = System.getProperty("context", "openmeetings");
    File home = new File(System.getenv("RED5_HOME"));
    OmFileHelper.setOmHome(new File(new File(home, "webapps"), ctxName));
   
    Parser parser = new PosixParser();
    try {
      cmdl = parser.parse(opts, args);
    } catch (ParseException e) {
      System.out.println(e.getMessage());
      usage();
      System.exit(1);
    }
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

      options.addOption(option);

    }

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

    cli.addOption("program", false, "URI to application executable", "class");
    cli.addOption("reduces", false, "number of reduces", "num");
    cli.addOption("jobconf", false,
        "\"n1=v1,n2=v2,..\" (Deprecated) Optional. Add or override a JobConf property.",
        "key=val");
    Parser parser = cli.createParser();
    try {
     
      GenericOptionsParser genericParser = new GenericOptionsParser(getConf(), args);
      CommandLine results =
        parser.parse(cli.options, genericParser.getRemainingArgs());
     
      JobConf job = new JobConf(getConf());
     
      if (results.hasOption("input")) {
        FileInputFormat.setInputPaths(job,
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, System.err);
      // Note, we print to System.err instead of ss.err, because if we can't parse our
      // commandline, we haven't even begun, and therefore cannot be expected to have
View Full Code Here

  public void run(String[] args) throws ParseException, IOException {
    Options options = new Options();
    buildOptions(options);

    Parser parser = new PosixParser();
    CommandLine cli = parser.parse(options, args);
    args = cli.getArgs();

    if (args.length != 2) {
      usage();
      System.exit(-1);
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.