Package org.apache.commons.cli

Examples of org.apache.commons.cli.OptionGroup


    createTableOptSplit.setArgName("filename");
    createTableOptFormatter.setArgName("className");

    // Splits and CopySplits are put in an optionsgroup to make them
    // mutually exclusive
    final OptionGroup splitOrCopySplit = new OptionGroup();
    splitOrCopySplit.addOption(createTableOptSplit);
    splitOrCopySplit.addOption(createTableOptCopySplits);

    final OptionGroup timeGroup = new OptionGroup();
    timeGroup.addOption(createTableOptTimeLogical);
    timeGroup.addOption(createTableOptTimeMillis);

    base64Opt = new Option("b64", "base64encoded", false, "decode encoded split points");
    o.addOption(base64Opt);

    o.addOptionGroup(splitOrCopySplit);
View Full Code Here


    public File[] parseCommandLine(String[] args) throws ParseException {
        final Option fileOpt = new Option("f", "file", true, "A single chanpub file to publish.");
        final Option dirOpt = new Option("d", "dir", true, "A directory of chanpub files to publish. (all .xml files in the directory will be processed)");

        final OptionGroup optGroup = new OptionGroup();
        optGroup.addOption(fileOpt);
        optGroup.addOption(dirOpt);
        optGroup.setRequired(true);

        final Options options = new Options();
        options.addOptionGroup(optGroup);

        final CommandLineParser parser = new GnuParser();
View Full Code Here

        .withLongOpt(STORAGE_METASTORE_ARG)
        .create());

    // Create an option-group surrounding the operations a user
    // can perform on jobs.
    OptionGroup group = new OptionGroup();
    group.addOption(OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Create a new saved job")
        .withLongOpt(JOB_CMD_CREATE_ARG)
        .create());
    group.addOption(OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Delete a saved job")
        .withLongOpt(JOB_CMD_DELETE_ARG)
        .create());
    group.addOption(OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Show the parameters for a saved job")
        .withLongOpt(JOB_CMD_SHOW_ARG)
        .create());

    Option execOption = OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Run a saved job")
        .withLongOpt(JOB_CMD_EXEC_ARG)
        .create();
    group.addOption(execOption);

    group.addOption(OptionBuilder
        .withDescription("List saved jobs")
        .withLongOpt(JOB_CMD_LIST_ARG)
        .create());

    relatedOpts.addOptionGroup(group);
View Full Code Here

    public String[] getArgs() {
        return commandLine.getArgs();
    }

    protected void addState() {
        OptionGroup optionGroup = new OptionGroup();

        Option option = new Option(ARGUMENT_ALL_SHORTFORM,
                ARGUMENT_ALL,
                false,
                "All modules will be listed.");
        optionGroup.addOption(option);

        option = new Option(ARGUMENT_STARTED_SHORTFORM,
                ARGUMENT_STARTED,
                false,
                "Only started modules will be listed.");
        optionGroup.addOption(option);

        option = new Option(ARGUMENT_STOPPED_SHORTFORM,
                ARGUMENT_STOPPED,
                false,
                "Only stopped modules will be listed.");
        optionGroup.addOption(option);

        options.addOptionGroup(optionGroup);
    }
View Full Code Here

        .create("su"));
    options.addOption(OptionBuilder.withArgName("Filemgr URL").hasArg()
        .withDescription("URL to the File Manager").withLongOpt("fmUrl")
        .create("fmu"));

    OptionGroup group = new OptionGroup();
    Option all = new Option("a", "all", false,
        "Index all products from the File Manager");
    Option product = OptionBuilder.withArgName("productId").hasArg()
        .withDescription("Index the product from the File Manager")
        .withLongOpt("product").create("p");
    Option met = OptionBuilder.withArgName("file").hasArg().withDescription(
        "Index the product from a metadata file").withLongOpt("metFile")
        .create("mf");
    Option read = new Option("r", "read", false,
        "Index all products based on a list of product identifiers passed in");
    Option types = new Option("t", "types", false,
        "Index all product types from the File Manager");
    Option deleteAll = new Option("da", "deleteAll", false,
        "Delete all products/types from the Solr index");

    group.addOption(all);
    group.addOption(product);
    group.addOption(met);
    group.addOption(read);
    group.addOption(types);
    group.addOption(deleteAll);
    options.addOptionGroup(group);

    return options;
  }
View Full Code Here

        .withLongOpt(STORAGE_METASTORE_ARG)
        .create());

    // Create an option-group surrounding the operations a user
    // can perform on jobs.
    OptionGroup group = new OptionGroup();
    group.addOption(OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Create a new saved job")
        .withLongOpt(JOB_CMD_CREATE_ARG)
        .create());
    group.addOption(OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Delete a saved job")
        .withLongOpt(JOB_CMD_DELETE_ARG)
        .create());
    group.addOption(OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Show the parameters for a saved job")
        .withLongOpt(JOB_CMD_SHOW_ARG)
        .create());

    Option execOption = OptionBuilder.withArgName("job-id")
        .hasArg()
        .withDescription("Run a saved job")
        .withLongOpt(JOB_CMD_EXEC_ARG)
        .create();
    group.addOption(execOption);

    group.addOption(OptionBuilder
        .withDescription("List saved jobs")
        .withLongOpt(JOB_CMD_LIST_ARG)
        .create());

    relatedOpts.addOptionGroup(group);
View Full Code Here

    options.addOption("p", "port", true, "Port to bind to [default: 9090]");
    options.addOption("f", "framed", false, "Use framed transport");
    options.addOption("c", "compact", false, "Use the compact protocol");
    options.addOption("h", "help", false, "Print help information");

    OptionGroup servers = new OptionGroup();
    servers.addOption(new Option("nonblocking", false, "Use the TNonblockingServer. This implies the framed transport."));
    servers.addOption(new Option("hsha", false, "Use the THsHaServer. This implies the framed transport."));
    servers.addOption(new Option("threadpool", false, "Use the TThreadPoolServer. This is the default."));
    options.addOptionGroup(servers);

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);
View Full Code Here

     
      mincScopeOpt = new Option(IteratorScope.minc.name(), "minor-compaction", false, "applied at minor compaction");
      majcScopeOpt = new Option(IteratorScope.majc.name(), "major-compaction", false, "applied at major compaction");
      scanScopeOpt = new Option(IteratorScope.scan.name(), "scan-time", false, "applied at scan time");
     
      OptionGroup typeGroup = new OptionGroup();
      classnameTypeOpt = new Option("class", "class-name", true, "a java class type");
      classnameTypeOpt.setArgName("name");
      aggTypeOpt = new Option("agg", "aggregator", false, "an aggregating type");
      regexTypeOpt = new Option("regex", "regular-expression", false, "a regex matching type");
      versionTypeOpt = new Option("vers", "version", false, "a versioning type");
      nolabelTypeOpt = new Option("nolabel", "no-label", false, "a no-labeling type");
      filterTypeOpt = new Option("filter", "filter", false, "a filtering type");
     
      typeGroup.addOption(classnameTypeOpt);
      typeGroup.addOption(aggTypeOpt);
      typeGroup.addOption(regexTypeOpt);
      typeGroup.addOption(versionTypeOpt);
      typeGroup.addOption(nolabelTypeOpt);
      typeGroup.addOption(filterTypeOpt);
      typeGroup.setRequired(true);
     
      o.addOption(tableOpt);
      o.addOption(priorityOpt);
      o.addOption(nameOpt);
      o.addOption(mincScopeOpt);
View Full Code Here

      Options modifiedOptions = new Options();
      for (Iterator<?> it = parentOptions.getOptions().iterator(); it.hasNext();) {
        Option o = (Option) it.next();
        if (!IteratorScope.majc.name().equals(o.getOpt()) && !IteratorScope.minc.name().equals(o.getOpt()) && !IteratorScope.scan.name().equals(o.getOpt())) {
          modifiedOptions.addOption(o);
          OptionGroup group = parentOptions.getOptionGroup(o);
          if (group != null)
            groups.add(group);
        }
      }
      for (OptionGroup group : groups) {
View Full Code Here

    }
   
    @Override
    public Options getOptions() {
      Options o = new Options();
      OptionGroup og = new OptionGroup();
     
      tableOpt = new Option(tableOption, "table", true, "display/set/delete properties for specified table");
      deleteOpt = new Option("d", "delete", true, "delete a per-table property");
      setOpt = new Option("s", "set", true, "set a per-table property");
      filterOpt = new Option("f", "filter", true, "show only properties that contain this string");
      disablePaginationOpt = new Option("np", "no-pagination", false, "disables pagination of output");
     
      tableOpt.setArgName("table");
      deleteOpt.setArgName("property");
      setOpt.setArgName("property=value");
      filterOpt.setArgName("string");
     
      og.addOption(deleteOpt);
      og.addOption(setOpt);
      og.addOption(filterOpt);
     
      o.addOption(tableOpt);
      o.addOptionGroup(og);
      o.addOption(disablePaginationOpt);
     
View Full Code Here

TOP

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

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.