Package org.apache.commons.cli

Examples of org.apache.commons.cli.HelpFormatter


    this.conf = HBaseConfiguration.create(conf);
  }

  private static void printUsageAndExit(Options options, int exitCode)
      throws ExitCodeException {
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("Thrift", null, options,
        "To start the Thrift server run 'bin/hbase-daemon.sh start thrift'\n" +
        "To shutdown the thrift server run 'bin/hbase-daemon.sh stop " +
        "thrift' or send a kill signal to the thrift server pid",
        true);
    throw new ExitCodeException(exitCode, "");
View Full Code Here


    CommandLineParser parser = new GnuParser();
    CommandLine commandLine = parser.parse(options, args);

    if (commandLine.hasOption('h')) {
      new HelpFormatter().printHelp("flume-ng avro-client", "", options,
          "The --dirname option assumes that a spooling directory exists " +
          "where immutable log files are dropped.", true);

      return false;
    }
View Full Code Here

        }
      } catch( ParseException exp ) {
          // oops, something went wrong
          System.err.println( "Parsing failed.  Reason: " + exp.getMessage() );
         
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp( "list", options );
      }       
    }
View Full Code Here

            }
        }
        File file = new File(command.getOptionValue("file", defaultFile));

        if (command.hasOption("help")) {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("java -jar " + file.getName(), options, true);
        } else if (command.hasOption("notice")) {
            copyToOutput("/META-INF/NOTICE.txt");
        } else if (command.hasOption("license")) {
            copyToOutput("/META-INF/LICENSE.txt");
        } else if (command.hasOption("cli")) {
View Full Code Here

      options.addOption("f", "file", true,
        "File to scan. Pass full-path; e.g. hdfs://a:9000/hbase/.META./12/34");
      options.addOption("r", "region", true,
        "Region to scan. Pass region name; e.g. '.META.,,1'");
      if (args.length == 0) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("HFile ", options, true);
        System.exit(-1);
      }
      CommandLineParser parser = new PosixParser();
      CommandLine cmd = parser.parse(options, args);
      boolean verbose = cmd.hasOption("v");
View Full Code Here

    public Cli()
    {
      _usage = "java " + NAME + " [options]";
      _cliOptions = new Options();
      constructCommandLineOptions();
      _helpFormatter = new HelpFormatter();
      _helpFormatter.setWidth(150);
    }
View Full Code Here

    _cmdLine = cmdLineParser.parse(_options, args);
  }

  public void printUsage()
  {
    HelpFormatter help = new HelpFormatter();
    help.setWidth(100);
    help.printHelp("java " + AvroConvertMain.class.getName() + " [options]", _options);
  }
View Full Code Here

    public Cli(String usage)
    {
      _usage = usage;
      _cliOptions = new Options();
      _helpFormatter = new HelpFormatter();
      _helpFormatter.setWidth(150);
    }
View Full Code Here

    }
  }

  private static void printCliHelp(Options cliOptions)
  {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.printHelp("java " + BootstrapAddSource.class.getName(), cliOptions);
  }
View Full Code Here

      }
  }

  private static void printCliHelp(Options cliOptions)
  {
    HelpFormatter helpFormatter = new HelpFormatter();
    helpFormatter.printHelp("java " + BootstrapDBCleanerMain.class.getName(), cliOptions);
  }
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.