Package org.apache.commons.cli

Examples of org.apache.commons.cli.HelpFormatter


      System.exit(-1);
    }

    if (!cmdline.hasOption(HOST_OPTION) || !cmdline.hasOption(PORT_OPTION)
        || !cmdline.hasOption(QUERIES_OPTION)) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(RunQueriesThrift.class.getName(), options);
      System.exit(-1);
    }

    String queryFile = cmdline.getOptionValue(QUERIES_OPTION);
    if (!new File(queryFile).exists()) {
View Full Code Here


      System.exit(-1);
    }

    if (!cmdline.hasOption(HOST_OPTION) || !cmdline.hasOption(PORT_OPTION)
        || !cmdline.hasOption(QUERIES_OPTION)) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(RunQueriesThrift.class.getName(), options);
      System.exit(-1);
    }

    String queryFile = cmdline.getOptionValue(QUERIES_OPTION);
    if (!new File(queryFile).exists()) {
View Full Code Here

      System.err.println("Error parsing command line: " + exp.getMessage());
      System.exit(-1);
  }
 
  if (!cmdline.hasOption(HTML_OPTION)) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(HTMLStatusExtractor.class.getName(), options);
      System.exit(-1);
  }
 
  String html_filename = cmdline.getOptionValue(HTML_OPTION);
  BufferedReader html_file = null;
View Full Code Here

        return options;
    }

    private static void printHelp(Options options) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("run", options, true);
    }
View Full Code Here

    opts.addOption(null, "public-server", false, "allow connections from external computers");
    opts.addOption(null, "no-password", false, "do not require a password from external connections " +
                   "(warning: for advanced users only!)");
    CommandLine line = parser.parse(opts, args);
    if (line.hasOption("help")) {
      new HelpFormatter().printHelp("beaker.command", opts);
      System.exit(0);
    }
    return line;
  }
View Full Code Here

        CommandLineParser parser = new PosixParser();
        CommandLine params = parser.parse(options, args);
        if (!params.hasOption("theme") || !params.hasOption("theme-folder")
                || !params.hasOption("version")) {
            // automatically generate the help statement
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp(CompileTheme.class.getName(), options);
            return;
        }
        String themeName = params.getOptionValue("theme");
        String themeFolder = params.getOptionValue("theme-folder");
        String version = params.getOptionValue("version");
View Full Code Here

        if (args.contains(CMD_ACTION_SET_DISPLAYNAME_EMAIL)) {
            return setDisplayNameAndOrEmail(cmd);
        }

        String actions = StringUtils.join(getActions(), " | ");
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(UserAdmin.class.getSimpleName() + " < " + actions + " >", getOptions());
        return -1;
    }
View Full Code Here

      line = parser.parse( options, args );
      if (line.getArgs().length != 0) {
        throw new ParseException("Unexpected options");
      }
    } catch (ParseException pe) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("TestFileAppend2", options);
      throw pe;
    }
           
    TestFileAppend2 tfa2 = new TestFileAppend2();
    tfa2.numDatanodes = Integer.parseInt(
View Full Code Here

      processGeneralOptions(conf, commandLine);
      return commandLine.getArgs();
    } catch(ParseException e) {
      LOG.warn("options parsing failed: "+e.getMessage());

      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("general options are: ", opts);
    }
    return args;
  }
View Full Code Here

    try {
      CommandLineParser parser = new GnuParser();
      cli = parser.parse(options, args);
    } catch(ParseException e) {
      LOG.warn("options parsing failed:  "+e.getMessage());
      new HelpFormatter().printHelp("...", options);
      return false;
    }

    if (cli.hasOption("help")) {
      new HelpFormatter().printHelp("...", options);
      return false;
    }
    if (cli.getArgs().length > 0) {
      for (String arg : cli.getArgs()) {
        System.err.println("Unrecognized option: " + arg);
        new HelpFormatter().printHelp("...", options);
        return false;
      }
    }

    // MR
View Full Code Here

TOP

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

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.