Package org.apache.commons.cli

Examples of org.apache.commons.cli.PosixParser


        return this;
    }

    // Parse the given argument vector
    public Command parse(String[] argv) {
        CommandLineParser parser = new PosixParser();

        CommandLine cmdline = null;
        try {
            cmdline = parser.parse(this.rules, argv);
        }
        catch (ParseException e) {
            error(e.getMessage());
        }
View Full Code Here


  }

  public static void main(String[] args) throws IOException, UnknownTypeException {

    // load and verify the options
    CommandLineParser parser = new PosixParser();
    Options opts = loadOptions();

    CommandLine cmd = null;
    try {
      cmd = parser.parse(opts, args);
    } catch (org.apache.commons.cli.ParseException parseEx) {
      LOG.error("Invalid option");
      printHelp(opts);
      return;
    }
View Full Code Here

    options.addOption(option);

    option = new Option("t", "graphite-port",  true, "Graphite server port");
    options.addOption(option);

    CommandLineParser parser = new PosixParser();
    CommandLine commandLine = null;
    try {
      commandLine = parser.parse(options, args);
    }
    catch(ParseException exception) {
      System.err.println(exception.getMessage());
      System.err.println("Usage: " + PushBot.class + " ARGS");
      System.err.println("  -n,--name                IRC Nick of the Bot");
View Full Code Here

        options.addOption("t", "theme", true, "the theme to compile");
        options.addOption("f", "theme-folder", true,
                "the folder containing the theme");
        options.addOption("v", "version", true,
                "the Vaadin version to compile for");
        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);
View Full Code Here

  public static void main(String args[]) {

    try {
      System.out.println(args[0]);

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

      if (line.hasOption("cassandrahostip")) {
        CountandraUtils.setCassandraHostIp(line
            .getOptionValue("cassandrahostip"));
        if (line.hasOption("consistencylevel")) {
View Full Code Here

    if(args.length == 0) {
      printUsage();
      return;
    }
   
    CommandLineParser parser = new PosixParser();
    CommandLine cmd;

    try {
      cmd = parser.parse(options, args);
    } catch (ParseException e) {
      System.out.println("Error parsing command-line options: ");
      printUsage();
      return;
    }
View Full Code Here

  static final public void main(String args[]) {
    String port;
    Server server;
    SocketConnector connector;
    CommandLine cmd = null;
    CommandLineParser parser = new PosixParser();
    Options o = new Options();

    BasicConfigurator.configure();

    o.addOption("p", true, "port");
    try {
      cmd = parser.parse(o, args);
    }
    catch (ParseException exp ) {
      System.err.println( "Parsing failed.  Reason: " + exp.getMessage() );
      System.exit(-1);
    }
View Full Code Here

    Options options = new Options();
    options.addOption("p", "port", true, "bind port");
    options.addOption("b", "base", true, "base path");
   
    try {
      CommandLine cl = new PosixParser().parse(options, args);
     
      int port = 8080;
      if (cl.hasOption('p')) {
        port = Integer.parseInt(cl.getOptionValue('p'));
      }
View Full Code Here

    // process command line

    Options options = new Options();
    options.addOption("p", "port", true, "service port");
    options.addOption("m", "multiuser", false, "enable multiuser mode");
    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);
    int port = 8080;
    if (cmd.hasOption("p")) {
      port = Integer.valueOf(cmd.getOptionValue("p"));
    }
View Full Code Here

    public boolean shouldPrintHelp() {
      return shouldPrintHelp;
    }
   
    public void parse(String ... argv) throws ParseException {
      CommandLineParser parser = new PosixParser();
      CommandLine cmdLine = parser.parse(options, argv);
     
      if (cmdLine.hasOption(helpOpt.getOpt())
          || cmdLine.hasOption(helpOpt.getLongOpt())) {
        shouldPrintHelp = true;
        return;
View Full Code Here

TOP

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

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.