Package org.apache.commons.cli

Examples of org.apache.commons.cli.Options


  }

  public static void main(String[] args)
    throws Exception
  {
    Options options = new Options();
    Option option;

    option = new Option("n", "name",  true, "Name");
    option.setRequired(true);
    options.addOption(option);

    option = new Option("c", "channels",  true, "A comma delimited set of channels to join");
    option.setRequired(true);
    options.addOption(option);

    option = new Option("h", "irc-host",  true, "The IRCD host");
    option.setRequired(true);
    options.addOption(option);

    option = new Option("p", "irc-port",  true, "The IRCD port");
    option.setRequired(true);
    options.addOption(option);

    option = new Option("a", "irc-pass",  true, "IRCd Server password");
    option.setRequired(false);
    options.addOption(option);

    option = new Option("g", "graphite-enabled",  false, "Set to true to log stats to graphite");
    options.addOption(option);

    option = new Option("r", "graphite-host",  true, "Graphite server hostname");
    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);
View Full Code Here


     *
     * @param args              not used
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        Options options = getOptions();
        CommandLine cmd = null;
        CommandLineParser parser = new GnuParser();
        try {
            cmd = parser.parse(options, args);
        } catch (ParseException pe) {
View Full Code Here

        new IndexDirectoryBuilder(fullAncestry).buildIndex(idir, gazetteerFiles, altNamesFile);
    }

    private static Options getOptions() {
        Options options = new Options();

        options.addOption(OptionBuilder
                .withLongOpt(HELP_OPTION)
                .withDescription("Print help")
                .create('?'));

        options.addOption(OptionBuilder
                .withLongOpt(FULL_ANCESTRY_OPTION)
                .withDescription("Store the gazetteer records for the full ancestry tree of each element."
                        + " This will increase performance at the expense of a larger index.")
                .create());

        options.addOption(OptionBuilder
                .withLongOpt(GAZETTEER_FILES_OPTION)
                .withDescription(String.format("The ':'-separated list of input Gazetteer files to parse.  Default: %s",
                        StringUtils.join(DEFAULT_GAZETTEER_FILES, ':')))
                .hasArgs()
                .withValueSeparator(':')
                .create('i'));

        options.addOption(OptionBuilder
                .withLongOpt(ALTERNATE_NAMES_OPTION)
                .withDescription("When provided, the path to the GeoNames.org alternate names file for resolution of common and "
                        + "short names for each location. If not provided, the default name for each location will be used.")
                .hasArg()
                .create());

        options.addOption(OptionBuilder
                .withLongOpt(INDEX_PATH_OPTION)
                .withDescription(String.format("The path to the output index directory. Default: %s", DEFAULT_INDEX_DIRECTORY))
                .hasArg()
                .create('o'));

        options.addOption(OptionBuilder
                .withLongOpt(REPLACE_INDEX_OPTION)
                .withDescription("Replace an existing index if it exists. If this option is not specified,"
                        + "index processing will fail if an index already exists at the specified location.")
                .create('r'));
View Full Code Here

  private static CommandLine parseCommandLine(String[] args)
    throws ParseException
  {
    CommandLineParser parser = new GnuParser();
    Options opts = new Options();
    opts.addOption("h", "help", false, "print this message");
    opts.addOption(null, "disable-kerberos", false, "do not require kerberos authentication");
    opts.addOption(null, "open-browser", true, "open a web browser connected to the Beaker server");
    opts.addOption(null, "port-base", true, "main port number to use, other ports are allocated starting here");
    opts.addOption(null, "default-notebook", true, "file name to find default notebook");
    opts.addOption(null, "plugin-option", true, "pass option on to plugin");
    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);
View Full Code Here

     * @param args
     * @throws IOException
     * @throws ParseException
     */
    public static void main(String[] args) throws IOException, ParseException {
        Options options = new Options();
        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")) {
View Full Code Here

        }
    }

    @Override
    protected Options getOptions() {
        Options opts = super.getOptions();

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_USERID)
                        .withDescription("The id of the user to view or edit")
                        .hasArg()
                        .create("i")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_USERNAME)
                        .withDescription("The username of the user to view or edit")
                        .hasArg()
                        .create("u")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_PASSWORD)
                        .withDescription("The password value to set")
                        .hasArg()
                        .create()
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_PRIVILEGES)
                        .withDescription("Comma separated list of privileges to set, one or more of: " + privilegesAsString(Privilege.ALL))
                        .hasArg()
                        .create("p")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_AUTHORIZATIONS)
                        .withDescription("Comma separated list of authorizations to set, or none")
                        .hasOptionalArg()
                        .create("a")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_DISPLAYNAME)
                        .withDescription("Display name to set")
                        .hasOptionalArg()
                        .create("d")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_EMAIL)
                        .withDescription("E-mail address to set")
                        .hasOptionalArg()
                        .create("e")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_AS_TABLE)
                        .withDescription("List users in a table")
                        .create("t")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_IDLE)
                        .withDescription("Include idle users")
                        .create()
        );
View Full Code Here

        }
    }

    @Override
    protected Options getOptions() {
        Options opts = super.getOptions();

        opts.addOption(
                OptionBuilder
                        .withLongOpt(OPT_FILE_NAME)
                        .withDescription("Name of file.")
                        .hasArg()
                        .withArgName("fileName")
                        .create("f")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(OPT_STREAM)
                        .withDescription("Stream the twitter data using HoseBirdClient.")
                        .create()
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(OPT_TWITTER4J)
                        .withDescription("Get data using Twitter4j.")
                        .create()
        );
View Full Code Here

        }
    }

    @Override
    protected Options getOptions() {
        Options opts = super.getOptions();

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_CACHE_DIRECTORY)
                        .withDescription("Directory to cache json documents in")
                        .hasArg()
                        .isRequired()
                        .create()
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_JSON_OUT)
                        .withDescription("The HDFS JSON output filename")
                        .hasArg()
                        .isRequired()
                        .create()
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_IMG_OUT)
                        .withDescription("The HDFS image output filename")
                        .hasArg()
                        .isRequired()
View Full Code Here

        initFramework = true;
    }

    @Override
    protected Options getOptions() {
        Options opts = super.getOptions();

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_LOCAL)
                        .withDescription("Run local")
                        .create("l")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_TASKS_PER_BOLT)
                        .withDescription("Max number of storm tasks")
                        .hasArg()
                        .withArgName("count")
                        .create("tpb")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_NUM_WORKERS)
                        .withDescription("Number of workers")
                        .hasArg()
                        .withArgName("count")
                        .create("w")
        );

        opts.addOption(
                OptionBuilder
                        .withLongOpt(CMD_OPT_PARALLELISM_HINT)
                        .withDescription("Parallelism hint")
                        .hasArg()
                        .withArgName("count")
View Full Code Here

        }
    }

    @Override
    protected Options getOptions() {
        Options options = super.getOptions();

        options.addOption(
                OptionBuilder
                        .withLongOpt("in")
                        .withDescription("Input file")
                        .isRequired()
                        .hasArg(true)
View Full Code Here

TOP

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

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.