Examples of CommandLineParser


Examples of org.apache.commons.cli.CommandLineParser

     *         options.
     */
    public CommandLine parseCommands(String[] args)
        throws ParseException
    {
        CommandLineParser parser = new PosixParser();
        return parser.parse(options, args);
    }
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

    options.addOption(helpOption);
    options.addOption(serverURLOption);
    options.addOption(keyOption);

    CommandLineParser argsParser = new PosixParser();

    try {
      CommandLine commandLine = argsParser.parse(options, args);

      if (commandLine.hasOption(helpOption.getOpt())) {
        printUsage(options);
        System.exit(0);
      }
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

  public static void main(String[] args)
    throws Exception
  {
    Options options = createCliOptions();
    CommandLineParser argsParser = new PosixParser();

    try {
      CommandLine commandLine = argsParser.parse(options, args);

      if (commandLine.hasOption(helpOption.getOpt())) {
        printUsage(options);
      }
      else if (commandLine.hasOption(versionOption.getOpt())) {
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

    OptionGroup connectGroup = new OptionGroup();
    connectGroup.addOption(serverURLOption);
    connectGroup.addOption(dirOption);
    options.addOptionGroup(connectGroup);

    CommandLineParser argsParser = new PosixParser();

    try {
      CommandLine commandLine = argsParser.parse(options, args);

      if (commandLine.hasOption(helpOption.getOpt())) {
        printUsage(options);
        System.exit(0);
      }
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

    createOptions();

        // set up array to return for public access to cmd line args
        _rawArgs = args;       

    final CommandLineParser parser = new GnuParser();
    try
    {
      _cmdLine = parser.parse(_options, args);
    }
    catch(ParseException ex)
    {
      System.err.println("Parsing failed. Reason: " + ex.getMessage());
      printHelp();
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

     * @param args    the command line args.
     * @return parsed command line.
     * @throws ParseException if there was a problem.
     */
    private static CommandLine parseCommandLine(Options options, String[] args) throws ParseException {
        CommandLineParser parser = new PosixParser();
        return parser.parse(options, args, true);
    }
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

      options.addOption(optSourceFile);
      options.addOption(optTargetFile);
      options.addOption(optLogLevel);
      options.addOption(optChangeUser);
     
      CommandLineParser parser = new GnuParser();
      CommandLine line=null;
      try{
        line = parser.parse(options, args);
      } catch(Exception e){
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("cronconverter", options, true);
        System.exit(0);
      }
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

        "The amount of time in secods to keep a thread alive when idle in " +
        ImplType.THREAD_POOL.simpleClassName());

    options.addOptionGroup(ImplType.createOptionGroup());

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);

    // This is so complicated to please both bin/hbase and bin/hbase-daemon.
    // hbase-daemon provides "start" and "stop" arguments
    // hbase should print the help if no argument is provided
    List<String> commandLine = Arrays.asList(args);
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

    options.addOption(opt);
    options.addOption(opt);
    opt = new Option("t", true, "capacity of the channel");
    opt.setRequired(true);
    options.addOption(opt);
    CommandLineParser parser = new GnuParser();
    CommandLine cli = parser.parse(options, args);
    File checkpointDir = new File(cli.getOptionValue("c"));
    String[] logDirs = cli.getOptionValue("l").split(",");
    List<File> logFiles = Lists.newArrayList();
    for (String logDir : logDirs) {
      File[] files = new File(logDir).listFiles();
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

        .addOption(null, "dirname", true, "directory to stream to avro source")
        .addOption("R", "headerFile", true, ("file containing headers as " +
            "key/value pairs on each new line"))
        .addOption("h", "help", false, "display help text");

    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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.