Example usage for org.apache.commons.cli OptionGroup setRequired

List of usage examples for org.apache.commons.cli OptionGroup setRequired

Introduction

In this page you can find the example usage for org.apache.commons.cli OptionGroup setRequired.

Prototype

public void setRequired(boolean required) 

Source Link

Usage

From source file:org.lockss.devtools.RunKbartReport.java

/**
 * Add the given OptionGroup to the options order list as well as the 
 * options spec./*w w  w  . j a  v a 2 s  .c  o  m*/
 * @param g an OptionGroup
 * @param setReq whether to set the option as a required one
 */
private static void addOptionGroup(OptionGroup g, boolean setReq) {
    g.setRequired(setReq);
    for (Object opt : g.getOptions()) {
        optionList.add((Option) opt);
    }
    options.addOptionGroup(g);
}

From source file:org.lockss.devtools.RunKbartReport.java

private static void selectDefaultGroupOption(OptionGroup og, Option opt) {
    try {//from w  w w. j  av a  2s .  com
        og.setSelected(opt);
    } catch (AlreadySelectedException e) {
        /*Don't care*/} catch (NoSuchElementException e) {
        System.err.format("The default option %s is not available.", opt);
        og.setRequired(true); // The user must specify
    }
}

From source file:org.marketcetera.ors.security.ORSAdminCLI.java

/**
 * Returns the options accepted by the CLI.
 *
 * @return the options accepted by the CLI
 *///from w ww.j  av  a2s.c o  m
private static Options options() {
    Options opts = new Options();
    opts.addOption(OptionBuilder.hasArg().withArgName(CLI_ARG_LOGIN_VALUE.getText())
            .withDescription(CLI_PARM_USER.getText()).isRequired(true).create(OPT_CURRENT_USER));
    opts.addOption(OptionBuilder.hasArg().withArgName(CLI_ARG_LOGIN_PASSWORD_VALUE.getText())
            .withDescription(CLI_PARM_PASSWORD.getText()).isRequired(false).create(OPT_CURRENT_PASSWORD));

    OptionGroup commands = new OptionGroup();
    commands.setRequired(true);
    commands.addOption(OptionBuilder.withLongOpt(CMD_LIST_USERS).withDescription(CLI_CMD_LIST_USERS.getText())
            .isRequired().create());
    commands.addOption(OptionBuilder.withLongOpt(CMD_ADD_USER).withDescription(CLI_CMD_ADD_USER.getText())
            .isRequired().create());
    commands.addOption(OptionBuilder.withLongOpt(CMD_DELETE_USER).withDescription(CLI_CMD_DELETE_USER.getText())
            .isRequired().create());
    commands.addOption(OptionBuilder.withLongOpt(CMD_RESTORE_USER)
            .withDescription(CLI_CMD_RESTORE_USER.getText()).isRequired().create());
    commands.addOption(OptionBuilder.withLongOpt(CMD_CHANGE_PASS)
            .withDescription(CLI_CMD_CHANGE_PASSWORD.getText()).isRequired().create());
    commands.addOption(OptionBuilder.withLongOpt(CMD_CHANGE_SUPERUSER)
            .withDescription(CLI_CMD_CHANGE_SUPERUSER.getText()).isRequired().create());
    opts.addOptionGroup(commands);
    //Add optional arguments
    opts.addOption(OptionBuilder.withLongOpt("username"). //$NON-NLS-1$
            hasArg().withArgName(CLI_ARG_USER_NAME_VALUE.getText()).withDescription(CLI_PARM_OP_USER.getText())
            .isRequired(false).create(OPT_OPERATED_USER));
    opts.addOption(OptionBuilder.withLongOpt("password"). //$NON-NLS-1$
            hasArg().withArgName(CLI_ARG_USER_PASSWORD_VALUE.getText())
            .withDescription(CLI_PARM_OP_PASSWORD.getText()).isRequired(false).create(OPT_OPERATED_PASSWORD));
    opts.addOption(OptionBuilder.withLongOpt("superuser"). //$NON-NLS-1$
            hasArg().withArgName(CLI_ARG_USER_SUPERUSER_VALUE.getText())
            .withDescription(CLI_PARM_OP_SUPERUSER.getText()).isRequired(false).create(OPT_OPERATED_SUPERUSER));
    opts.addOption(OptionBuilder.withLongOpt("active"). //$NON-NLS-1$
            hasArg().withArgName(CLI_ARG_USER_ACTIVE_VALUE.getText())
            .withDescription(CLI_PARM_OP_ACTIVE.getText()).isRequired(false).create(OPT_OPERATED_ACTIVE));
    return opts;
}

From source file:org.midonet.midolman.tools.MmCtl.java

private static OptionGroup getOptionalOptionGroup() {
    OptionGroup optionalGroup = new OptionGroup();

    OptionBuilder.hasArg();//from  w  ww .j  a va  2  s .  co  m
    OptionBuilder.withLongOpt("config");
    OptionBuilder.withDescription("MM configuration file");
    optionalGroup.addOption(OptionBuilder.create());

    optionalGroup.setRequired(false);
    return optionalGroup;
}

From source file:org.midonet.midolman.tools.MmCtl.java

private static OptionGroup getMutuallyExclusiveOptionGroup() {

    // The command line tool can only accept one of these options:
    OptionGroup mutuallyExclusiveOptions = new OptionGroup();

    OptionBuilder.hasArgs(2);/*from   w  w w  . j ava2 s.  c om*/
    OptionBuilder.isRequired();
    OptionBuilder.withLongOpt("bind-port");
    OptionBuilder.withDescription("Bind a port to an interface");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    OptionBuilder.hasArg();
    OptionBuilder.isRequired();
    OptionBuilder.withLongOpt("unbind-port");
    OptionBuilder.withDescription("Unbind a port from an interface");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    OptionBuilder.withLongOpt("list-hosts");
    OptionBuilder.withDescription("List MidolMan agents in the system");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    // make sure that there is at least one.
    mutuallyExclusiveOptions.setRequired(true);

    return mutuallyExclusiveOptions;
}

From source file:org.midonet.mmdpctl.Mmdpctl.java

public static void main(String... args) {
    Options options = new Options();

    // The command line tool can only accept one of these options:
    OptionGroup mutuallyExclusiveOptions = new OptionGroup();

    OptionBuilder.withDescription("List all the installed datapaths");
    OptionBuilder.isRequired();//from   w w w  .  j a  va  2 s  .  co  m
    OptionBuilder.withLongOpt("list-dps");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    OptionBuilder.withDescription("Show all the information related to a given datapath.");
    OptionBuilder.hasArg();
    OptionBuilder.isRequired();
    OptionBuilder.withLongOpt("show-dp");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    OptionBuilder.withDescription("Show all the flows installed for a given datapath.");
    OptionBuilder.hasArg();
    OptionBuilder.isRequired();
    OptionBuilder.withLongOpt("dump-dp");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    OptionBuilder.withDescription("Add a new datapath.");
    OptionBuilder.hasArg();
    OptionBuilder.withLongOpt("add-dp");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    OptionBuilder.withDescription("Delete a datapath.");
    OptionBuilder.hasArg();
    OptionBuilder.withLongOpt("delete-dp");
    mutuallyExclusiveOptions.addOption(OptionBuilder.create());

    // make sure that there is at least one.
    mutuallyExclusiveOptions.setRequired(true);
    options.addOptionGroup(mutuallyExclusiveOptions);

    // add an optional timeout to the command.
    OptionBuilder.withDescription(
            "Specifies a timeout in seconds. " + "If the program is not able to get the results in less than "
                    + "this amount of time it will stop and return with an error code");
    OptionBuilder.hasArg();
    OptionBuilder.withLongOpt("timeout");
    options.addOption(OptionBuilder.create());

    CommandLineParser parser = new PosixParser();
    try {
        CommandLine cl = parser.parse(options, args);

        Mmdpctl mmdpctl = new Mmdpctl();

        // check if the user sets a (correct) timeout.
        if (cl.hasOption("timeout")) {
            String timeoutString = cl.getOptionValue("timeout");
            Integer timeout = Integer.parseInt(timeoutString);
            if (timeout > 0) {
                log.info("Installing a timeout of {} seconds", timeout);
                mmdpctl.setTimeout(timeout);
            } else {
                System.out.println("The timeout needs to be a positive number, bigger than 0.");
                System.exit(1);
            }
        }

        if (cl.hasOption("list-dps")) {
            System.exit(mmdpctl.execute(new ListDatapathsCommand()));
        } else if (cl.hasOption("show-dp")) {
            System.exit(mmdpctl.execute(new GetDatapathCommand(cl.getOptionValue("show-dp"))));
        } else if (cl.hasOption("dump-dp")) {
            System.exit(mmdpctl.execute(new DumpDatapathCommand(cl.getOptionValue("dump-dp"))));
        } else if (cl.hasOption("add-dp")) {
            System.exit(mmdpctl.execute(new AddDatapathCommand(cl.getOptionValue("add-dp"))));
        } else if (cl.hasOption("delete-dp")) {
            System.exit(mmdpctl.execute(new DeleteDatapathCommand(cl.getOptionValue("delete-dp"))));
        }

    } catch (ParseException e) {
        showHelpAndExit(options, e.getMessage());
    }

    System.exit(0);
}

From source file:org.openmainframe.ade.ext.main.AdeUtilMain.java

/**
 * Parse the input arguments//from   w  w  w  .  ja  va 2  s  . c  o m
 */
@SuppressWarnings("static-access")
@Override
protected void parseArgs(String[] args) throws AdeUsageException {
    Options options = new Options();

    Option helpOpt = new Option("h", "help", false, "Print help message and exit");
    options.addOption(helpOpt);

    Option versionOpt = OptionBuilder.withLongOpt("version").hasArg(false).isRequired(false)
            .withDescription("Print current Ade version (JAR) and exit").create('v');
    options.addOption(versionOpt);

    Option dbVersionOpt = OptionBuilder.withLongOpt("db-version")
            .withDescription("Print current Ade DB version and exit").create('b');
    options.addOption(dbVersionOpt);

    Option outputFileOpt = OptionBuilder.withLongOpt("output").hasArg(true).withArgName("FILE")
            .isRequired(false).withDescription("Output file name (where relevant)").create('o');
    options.addOption(outputFileOpt);

    OptionGroup optGroup = new OptionGroup();
    optGroup.setRequired(false);

    Option DumpModelDebugOpt = OptionBuilder.withLongOpt("debugPrint").hasArg(true).withArgName("MODEL FILE")
            .isRequired(false).withDescription("Extract a text version of a model debug information and exit")
            .create('d');
    optGroup.addOption(DumpModelDebugOpt);

    Option verifyFlowOpt = OptionBuilder.withLongOpt("verifyFlow").hasArg(true).withArgName("FLOW FILE")
            .isRequired(false).withDescription("Verify the flow file matches the XSD standard and exit")
            .create('f');
    optGroup.addOption(verifyFlowOpt);

    options.addOptionGroup(optGroup);

    CommandLineParser parser = new GnuParser();
    CommandLine line = null;

    try {
        // parse the command line arguments
        line = parser.parse(options, args);
    } catch (MissingOptionException exp) {
        System.out.println("Command line parsing failed.  Reason: " + exp.getMessage());
        System.out.println();
        new HelpFormatter().printHelp(ControlDB.class.getName(), options);
        System.exit(0);
    } catch (ParseException exp) {
        // oops, something went wrong
        System.err.println("Parsing failed.  Reason: " + exp.getMessage());
        throw new AdeUsageException("Argument Parsing failed", exp);
    }

    if (line.hasOption('h')) {
        new HelpFormatter().printHelp(this.getClass().getSimpleName(), options);
        System.exit(0);
    }
    if (line.hasOption(helpOpt.getLongOpt())) {
        new HelpFormatter().printHelp(getClass().getSimpleName(), options);
    }

    if (line.hasOption(outputFileOpt.getLongOpt())) {
        m_outputFile = new File(line.getOptionValue(outputFileOpt.getLongOpt()));
    }

    m_inputFile = null;

    m_cmd = null;

    if (line.hasOption('v')) {
        m_cmd = "version";
    }

    if (line.hasOption('b')) {
        m_cmd = "db-version";
    }

    if (line.hasOption('d')) {
        m_inputFile = new File(line.getOptionValue(DumpModelDebugOpt.getLongOpt()));
        m_cmd = "debugPrint";
    }

    if (line.hasOption('f')) {
        m_inputFilename = line.getOptionValue(verifyFlowOpt.getLongOpt());
        m_cmd = "verifyFlow";
    }

}

From source file:org.openmainframe.ade.main.AdeUtilMain.java

@SuppressWarnings("static-access")
@Override//w  w  w  .  ja  v  a 2 s  .c  o  m
protected void parseArgs(String[] args) throws AdeException {
    Options options = new Options();

    Option helpOpt = new Option("h", "help", false, "Print help message and exit");
    options.addOption(helpOpt);

    Option versionOpt = OptionBuilder.withLongOpt("version").hasArg(false).isRequired(false)
            .withDescription("Print current Ade version (JAR) and exit").create('V');
    options.addOption(versionOpt);

    Option dbVersionOpt = OptionBuilder.withLongOpt("db-version")
            .withDescription("Print current Ade DB version and exit").create();
    options.addOption(dbVersionOpt);

    Option outputFileOpt = OptionBuilder.withLongOpt("output").hasArg(true).withArgName("FILE")
            .isRequired(false).withDescription("Output file name (where relevant)").create('o');

    options.addOption(outputFileOpt);

    OptionGroup optGroup = new OptionGroup();
    optGroup.setRequired(false);

    Option DumpModelOpt = OptionBuilder.withLongOpt("model").hasArg(true).withArgName("MODEL FILE")
            .isRequired(false).withDescription("Extract a text version of a model (csv) and exit").create('m');
    optGroup.addOption(DumpModelOpt);

    Option DumpModelDebugOpt = OptionBuilder.withLongOpt("debugPrint").hasArg(true).withArgName("MODEL FILE")
            .isRequired(false).withDescription("Extract a text version of a model debug information and exit")
            .create('d');
    optGroup.addOption(DumpModelDebugOpt);

    Option verifyFlowOpt = OptionBuilder.withLongOpt("verifyFlow").hasArg(true).withArgName("FLOW FILE")
            .isRequired(false).withDescription("Verify the flow file matches the XSD standard and exit")
            .create('f');
    optGroup.addOption(verifyFlowOpt);

    options.addOptionGroup(optGroup);

    CommandLineParser parser = new GnuParser();
    CommandLine line = null;

    try {
        // parse the command line arguments
        line = parser.parse(options, args);
    } catch (MissingOptionException exp) {
        System.out.println("Command line parsing failed.  Reason: " + exp.getMessage());
        System.out.println();
        new HelpFormatter().printHelp(ControlDB.class.getName(), options);
        System.exit(0);
    } catch (ParseException exp) {
        // oops, something went wrong
        System.err.println("Parsing failed.  Reason: " + exp.getMessage());
        throw new AdeUsageException("Argument Parsing failed", exp);
    }

    if (line.hasOption(helpOpt.getLongOpt())) {
        new HelpFormatter().printHelp(getClass().getSimpleName(), options);
        closeAll();
        System.exit(0);
    }
    if (line.hasOption(versionOpt.getLongOpt())) {
        System.out.println("Current Ade version (JAR): " + Ade.getAde().getVersion());
        closeAll();
        System.exit(0);
    }
    if (line.hasOption(dbVersionOpt.getLongOpt())) {
        System.out.println("Current Ade DB version: " + Ade.getAde().getDbVersion());
        closeAll();
        System.exit(0);
    }

    File outputFile = null;
    if (line.hasOption(outputFileOpt.getLongOpt())) {
        outputFile = new File(line.getOptionValue(outputFileOpt.getLongOpt()));
    }

    if (line.hasOption(DumpModelDebugOpt.getLongOpt())) {
        File modelFile = new File(line.getOptionValue(DumpModelDebugOpt.getLongOpt()));
        dumpModelDebug(modelFile, outputFile);
    }
    if (line.hasOption(verifyFlowOpt.getLongOpt())) {
        String flowFilename = line.getOptionValue(verifyFlowOpt.getLongOpt());
        File flowFile = new File(flowFilename);
        try {
            validateGood(flowFile);
        } catch (Exception e) {
            throw new AdeUsageException("Failed when verifiying " + flowFile.getName(), e);
        }
    }

}

From source file:org.openmainframe.ade.main.ControlDB.java

@Override
protected void parseArgs(String[] args) throws AdeException {

    final Option helpOpt = new Option("h", "help", false, "Print help message and exit");
    final Option forceOpt = new Option("f", "force", false, "Force operation. Do not prompt for confirmation");

    OptionBuilder.withLongOpt("create");
    OptionBuilder.hasArg(false);/*from ww  w. j  a v a  2s  .c  o  m*/
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Create Ade DB tables");
    final Option createOpt = OptionBuilder.create('c');

    OptionBuilder.withLongOpt("drop");
    OptionBuilder.hasArg(false);
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Drops all Ade DB tables, and clears the data store dictionaries");
    final Option deleteOpt = OptionBuilder.create('d');

    OptionBuilder.withLongOpt("reset");
    OptionBuilder.hasArg(false);
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Clears all Ade DB tables content");
    final Option resetOpt = OptionBuilder.create('r');

    OptionBuilder.withLongOpt("query");
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("SQL query string");
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Performs the input query");
    final Option queryOpt = OptionBuilder.create('q');

    final OptionGroup actionGroupOpt = new OptionGroup().addOption(createOpt).addOption(deleteOpt)
            .addOption(resetOpt).addOption(queryOpt);
    actionGroupOpt.setRequired(true);

    final Options options = new Options();
    options.addOption(helpOpt);
    options.addOption(forceOpt);
    options.addOptionGroup(actionGroupOpt);

    final CommandLineParser parser = new GnuParser();
    CommandLine line = null;

    try {
        // parse the command line arguments
        line = parser.parse(options, args);
    } catch (MissingOptionException exp) {
        logger.error("Command line parsing failed.", exp);
        new HelpFormatter().printHelp(ControlDB.class.getName(), options);
        System.exit(0);
    } catch (ParseException exp) {
        // oops, something went wrong
        logger.error("Parsing failed.  Reason: " + exp.getMessage());
        throw new AdeUsageException("Argument Parsing failed", exp);
    }

    if (line.hasOption('h')) {
        new HelpFormatter().printHelp(getClass().getSimpleName(), options);
        closeAll();
        System.exit(0);
    }

    if (line.hasOption('f')) {
        m_forceOp = true;
    }

    if (line.hasOption('c')) {
        m_op = ControlDBOperator.Create;
    } else if (line.hasOption('d')) {
        m_op = ControlDBOperator.Drop;
    } else if (line.hasOption('r')) {
        m_op = ControlDBOperator.Reset;
    } else if (line.hasOption('q')) {
        m_op = ControlDBOperator.Query;
        m_args = new String[] { line.getOptionValue('q') };
    }
}

From source file:org.openmainframe.ade.main.Train.java

@Override
protected void parseArgs(String[] args) throws AdeException {
    final Option helpOpt = new Option("h", "help", false, "Print help message and exit");

    OptionBuilder.withLongOpt(ALL_OPT);/*from   w  w  w  .ja v a2  s .  c om*/
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("All analysis groups");
    final Option allAnalysisGroupsOpt = OptionBuilder.create('a');

    OptionBuilder.withLongOpt(GROUPS_OPT);
    OptionBuilder.withArgName("ANALYSIs GROUPS");
    OptionBuilder.hasArgs();
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Selected analysis groups");
    final Option selectAnalysisGroupsOpt = OptionBuilder.create('s');

    final OptionGroup inputAnalysisGroupsOptGroup = new OptionGroup().addOption(allAnalysisGroupsOpt)
            .addOption(selectAnalysisGroupsOpt);
    inputAnalysisGroupsOptGroup.setRequired(true);

    OptionBuilder.withLongOpt(UNSELECT_OPT);
    OptionBuilder.withArgName("ANALYSIS GROUPS");
    OptionBuilder.hasArgs();
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Unselect analysis groups. Used only with '" + ALL_OPT + "'");
    final Option unselectAnalysisGroupsOpt = OptionBuilder.create('u');

    OptionBuilder.withLongOpt(DURATION_OPT);
    OptionBuilder.withArgName("DURATION (ISO 8601)");
    OptionBuilder.isRequired(false);
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "Duration from/to start/end date. Defaults to infinity. Replaces either 'start-date' or 'end-date'");
    final Option periodOpt = OptionBuilder.create();

    OptionBuilder.withLongOpt(NUM_DAYS_OPT);
    OptionBuilder.withArgName("INT");
    OptionBuilder.hasArg();
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription("Number of days. same as '" + DURATION_OPT + "'");
    final Option numDaysOpt = OptionBuilder.create('n');

    final OptionGroup periodOptGroup = new OptionGroup().addOption(periodOpt).addOption(numDaysOpt);

    OptionBuilder.withLongOpt(START_DATE_OPT);
    OptionBuilder.withArgName("MM/dd/yyyy[ HH:mm][ Z]");
    OptionBuilder.hasArg();
    OptionBuilder.isRequired(false);
    OptionBuilder.withDescription(
            "Start of date range. Optional. Replaces 'duration'/'num-days' when used along with 'end-date'");
    final Option startDateOpt = OptionBuilder.create();

    OptionBuilder.withLongOpt(END_DATE_OPT);
    OptionBuilder.withArgName("MM/dd/yyyy[ HH:mm][ Z]");
    OptionBuilder.hasArg();
    OptionBuilder.isRequired(false);
    OptionBuilder
            .withDescription("End of date range. Defaults to this moment. Replaces 'duration'/'num-days' when"
                    + " used along with 'start-date'");
    final Option endDateOpt = OptionBuilder.create();

    final Options options = new Options();
    options.addOption(helpOpt);
    options.addOptionGroup(inputAnalysisGroupsOptGroup);
    options.addOption(unselectAnalysisGroupsOpt);
    options.addOptionGroup(periodOptGroup);
    options.addOption(endDateOpt);
    options.addOption(startDateOpt);

    final CommandLineParser parser = new GnuParser();
    CommandLine line;

    try {
        // parse the command line arguments
        line = parser.parse(options, args);
    } catch (MissingOptionException exp) {
        new HelpFormatter().printHelp(HELP + "\nOptions:", options);
        throw new AdeUsageException("Command line parsing failed", exp);
    } catch (ParseException exp) {
        // oops, something went wrong
        throw new AdeUsageException("Argument Parsing failed", exp);
    }

    if (line.hasOption(helpOpt.getLongOpt())) {
        new HelpFormatter().printHelp(HELP, options);
        closeAll();
        System.exit(0);
    }

    if (line.hasOption(UNSELECT_OPT) && !line.hasOption(ALL_OPT)) {
        throw new AdeUsageException("'" + UNSELECT_OPT + "' cannot be used without '" + ALL_OPT + "'");
    }

    final Set<Integer> allAnalysisGroups = Ade.getAde().getDataStore().sources().getAllAnalysisGroups();
    if (line.hasOption(ALL_OPT)) {
        System.out.println("Operating on all available analysis groups");
        if (!line.hasOption(UNSELECT_OPT)) {
            m_analysisGroups = allAnalysisGroups;
        } else {
            final Set<Integer> unselectedAnalysisGroups = parseAnalysisGroups(allAnalysisGroups,
                    line.getOptionValues(UNSELECT_OPT));
            final Set<String> unselectedGroupNames = getGroupNames(unselectedAnalysisGroups);
            System.out.println("Omitting analysis groups: " + unselectedGroupNames.toString());
            m_analysisGroups = new TreeSet<Integer>(allAnalysisGroups);
            m_analysisGroups.removeAll(unselectedAnalysisGroups);
        }
    } else if (line.hasOption(GROUPS_OPT)) {
        m_analysisGroups = parseAnalysisGroups(allAnalysisGroups, line.getOptionValues(GROUPS_OPT));
        final Set<String> operatingAnalysisGroups = getGroupNames(m_analysisGroups);
        System.out.println("Operating on analysis groups: " + operatingAnalysisGroups.toString());
    }

    if ((line.hasOption(NUM_DAYS_OPT) || line.hasOption(DURATION_OPT)) && line.hasOption(START_DATE_OPT)
            && line.hasOption(END_DATE_OPT)) {
        throw new AdeUsageException("Cannot use '" + DURATION_OPT + "'/'" + NUM_DAYS_OPT + "', '"
                + START_DATE_OPT + "' and '" + END_DATE_OPT + "' together");
    }
    if (line.hasOption(NUM_DAYS_OPT)) {
        final String numDaysStr = line.getOptionValue(NUM_DAYS_OPT);
        final int numDays = Integer.parseInt(numDaysStr);
        this.m_period = Period.days(numDays);
    }
    if (line.hasOption(DURATION_OPT)) {
        final String periodStr = line.getOptionValue(DURATION_OPT);
        this.m_period = ISOPeriodFormat.standard().parsePeriod(periodStr);
    }
    if (line.hasOption(START_DATE_OPT)) {
        m_startDate = parseDate(line.getOptionValue(START_DATE_OPT));
    }
    if (line.hasOption(END_DATE_OPT)) {
        m_endDate = parseDate(line.getOptionValue(END_DATE_OPT));
    }
}