Package org.apache.commons.cli

Examples of org.apache.commons.cli.GnuParser


    options.addOption(helpOpts);
    options.addOption(webGraphDbOpts);
    options.addOption(basicFieldOpts);
    options.addOption(outputOpts);

    CommandLineParser parser = new GnuParser();
    try {

      CommandLine line = parser.parse(options, args);
      if (line.hasOption("help") || !line.hasOption("webgraphdb")
        || !line.hasOption("output") || !line.hasOption("basicfields")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("AnchorFields", options);
        return -1;
View Full Code Here


    options.addOption(helpOpts);
    options.addOption(inputOpts);
    options.addOption(basicFieldOpts);
    options.addOption(outputOpts);

    CommandLineParser parser = new GnuParser();
    try {

      CommandLine line = parser.parse(options, args);
      if (line.hasOption("help") || !line.hasOption("output")
        || !line.hasOption("basicfields")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("CustomFields", options);
        return -1;
View Full Code Here

      "the segment(s) to use").create("segment");
    options.addOption(helpOpts);
    options.addOption(crawlDbOpts);
    options.addOption(segOpts);

    CommandLineParser parser = new GnuParser();
    try {

      // parse out common line arguments and make sure either a crawldb or a
      // segment are specified
      CommandLine line = parser.parse(options, args);
      if (line.hasOption("help")
        || (!line.hasOption("crawldb") && !line.hasOption("segment"))) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("ReprUtilFixer", options);
        return -1;
View Full Code Here

      "the field database(s) to use").create("fields");
    options.addOption(helpOpts);
    options.addOption(fieldOpts);
    options.addOption(outputOpts);

    CommandLineParser parser = new GnuParser();
    try {

      CommandLine line = parser.parse(options, args);
      if (line.hasOption("help") || !line.hasOption("fields")
        || !line.hasOption("output")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("FieldIndexer", options);
        return -1;
View Full Code Here

    options.addOption(helpOpts);
    options.addOption(queriesOpts);
    options.addOption(numThreadOpts);
    options.addOption(showTimesOpts);

    CommandLineParser parser = new GnuParser();
    try {

      // parse out common line arguments
      CommandLine line = parser.parse(options, args);
      if (line.hasOption("help") || !line.hasOption("queries")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("SearchTester", options);
        return;
      }
View Full Code Here

        opt = new Option("logFile", true, "log file for capturing size of feed");
        opt.setRequired(true);
        options.addOption(opt);

        return new GnuParser().parse(options, args);
    }
View Full Code Here

   * @return Command-specific arguments
   */
  private String[] parseGeneralOptions(Options opts, Configuration conf,
      String[] args) {
    opts = buildGeneralOptions(opts);
    CommandLineParser parser = new GnuParser();
    try {
      commandLine = parser.parse(opts, args, true);
      processGeneralOptions(conf, commandLine);
      return commandLine.getArgs();
    } catch(ParseException e) {
      LOG.warn("options parsing failed: "+e.getMessage());

View Full Code Here

    return options;
  }

  public static void processCommandLineArgs(String[] cliArgs) throws Exception {
    CommandLineParser cliParser = new GnuParser();
    Options cliOptions = constructCommandLineOptions();
    CommandLine cmd = null;

    try {
      cmd = cliParser.parse(cliOptions, cliArgs);
    } catch (ParseException pe) {
      System.err.println("RestAdminApplication: failed to parse command-line options: "
          + pe.toString());
      printUsage(cliOptions);
      System.exit(1);
View Full Code Here

    helpFormatter.setWidth(1000);
    helpFormatter.printHelp("java " + HelixAgentMain.class.getName(), cliOptions);
  }

  public static CommandLine processCommandLineArgs(String[] cliArgs) throws Exception {
    CommandLineParser cliParser = new GnuParser();
    Options cliOptions = constructCommandLineOptions();

    try {
      return cliParser.parse(cliOptions, cliArgs);
    } catch (ParseException pe) {
      LOG.error("fail to parse command-line options. cliArgs: " + Arrays.toString(cliArgs), pe);
      printUsage(cliOptions);
      System.exit(1);
    }
View Full Code Here

    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.printHelp("java " + BootstrapProcess.class.getName(), cliOptions);
  }

  public static CommandLine processCommandLineArgs(String[] cliArgs) throws Exception {
    CommandLineParser cliParser = new GnuParser();
    Options cliOptions = constructCommandLineOptions();
    try {
      return cliParser.parse(cliOptions, cliArgs);
    } catch (ParseException pe) {
      System.err.println("CommandLineClient: failed to parse command-line options: "
          + pe.toString());
      printUsage(cliOptions);
      System.exit(1);
View Full Code Here

TOP

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

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.