Example usage for org.apache.commons.cli OptionBuilder withDescription

List of usage examples for org.apache.commons.cli OptionBuilder withDescription

Introduction

In this page you can find the example usage for org.apache.commons.cli OptionBuilder withDescription.

Prototype

public static OptionBuilder withDescription(String newDescription) 

Source Link

Document

The next Option created will have the specified description

Usage

From source file:com.google.api.ads.adwords.keywordoptimizer.KeywordOptimizer.java

/**
 * Creates the command line structure / options.
 *
 * @return the command line {@link Options}
 *///from  w  w  w.  jav  a  2s . c o  m
private static Options createCommandLineOptions() {
    Options options = new Options();

    OptionBuilder.withLongOpt("keyword-properties");
    OptionBuilder.withDescription("Location of the keyword-optimizer.properties file.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("kp"));

    OptionBuilder.withLongOpt("ads-properties");
    OptionBuilder.withDescription("Location of the ads.properties file.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("ap"));

    OptionBuilder.withLongOpt("help");
    OptionBuilder.withDescription("Shows this help screen.");
    OptionBuilder.withArgName("help");
    options.addOption(OptionBuilder.create("h"));

    OptionBuilder.withLongOpt("seed-keywords");
    OptionBuilder.withDescription("Use the given keywords (separated by spaces) as a seed for the optimization."
            + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("keywords");
    options.addOption(OptionBuilder.create("sk"));

    OptionBuilder.withLongOpt("seed-keywords-file");
    OptionBuilder.withDescription(
            "Use the keywords from the given file (one keyword per row) as a seed for the optimization."
                    + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("skf"));

    OptionBuilder.withLongOpt("seed-terms");
    OptionBuilder
            .withDescription("Use the given search terms (separated by spaces) as a seed for the optimization."
                    + "\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("terms");
    options.addOption(OptionBuilder.create("st"));

    OptionBuilder.withLongOpt("seed-terms-file");
    OptionBuilder.withDescription("Use the search terms from the given file (one keyword per row) as a seed "
            + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("stf"));

    OptionBuilder.withLongOpt("seed-urls");
    OptionBuilder.withDescription("Use the given urls (separated by spaces) to extract keywords as a seed for "
            + "the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("urls");
    options.addOption(OptionBuilder.create("su"));

    OptionBuilder.withLongOpt("seed-urls-file");
    OptionBuilder
            .withDescription("Use the urls from the given file (one url per row) to extract keywords as a seed "
                    + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("suf"));

    OptionBuilder.withLongOpt("seed-category");
    OptionBuilder.withDescription(
            "Use the given category (ID as defined @ https://goo.gl/xUEr6s) to get keywords as a seed "
                    + "for the optimization.\nNote: Only one seed-* option is allowed.");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("id");
    options.addOption(OptionBuilder.create("sc"));

    OptionBuilder.withLongOpt("match-types");
    OptionBuilder.withDescription("Use the given keyword match types (EXACT, BROAD, PHRASE).");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(3);
    OptionBuilder.withArgName("types");
    options.addOption(OptionBuilder.create("m"));

    OptionBuilder.withLongOpt("max-cpc");
    OptionBuilder.withDescription("Use the given maximum CPC (in USD, e.g., 5.0 for $5).");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("double");
    options.addOption(OptionBuilder.create("cpc"));

    OptionBuilder.withLongOpt("locations");
    OptionBuilder.withDescription("Use the given locations IDs (ID as defined @ https://goo.gl/TA5E81) for "
            + "geo-targeted results.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("ids");
    options.addOption(OptionBuilder.create("loc"));

    OptionBuilder.withLongOpt("languages");
    OptionBuilder.withDescription("Use the given locations IDs (ID as defined @ https://goo.gl/WWzifs) for "
            + "language-targeted results.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(Option.UNLIMITED_VALUES);
    OptionBuilder.withArgName("ids");
    options.addOption(OptionBuilder.create("lang"));

    OptionBuilder.withLongOpt("output");
    OptionBuilder.withDescription("Mode for outputting results (CONSOLE / CSV)\nNote: If set to CSV, then "
            + "option -of also has to be specified.");
    OptionBuilder.hasArg(true);
    OptionBuilder.hasArgs(2);
    OptionBuilder.withArgName("mode");
    options.addOption(OptionBuilder.create("o"));

    OptionBuilder.withLongOpt("output-file");
    OptionBuilder.withDescription("File to for writing output data (only needed if option -o is specified).");
    OptionBuilder.hasArg(true);
    OptionBuilder.withArgName("file");
    options.addOption(OptionBuilder.create("of"));

    return options;
}

From source file:com.symbian.utils.cmdline.CmdLine.java

/**
 * Adds a switch to a command./*from   w w  w  . jav  a  2  s . c  o m*/
 * 
 * @param aSwitchName
 *            name of the switch
 * @param aIsSingle
 *            If the switch is single.
 * @param aDescription
 *            description of the switch (for help command)
 * @param aIsMandatory
 *            make switch mandatory
 * @param aDataCheck
 *            facility to check the validity of the parameter.
 */
public synchronized void addSwitch(final String aSwitchName, final boolean aIsSingle, final String aDescription,
        final boolean aIsMandatory, final DataAcceptable aDataCheck) {

    Option lOption = null;

    OptionBuilder.withArgName(aSwitchName);
    OptionBuilder.withDescription(aDescription);
    OptionBuilder.isRequired(aIsMandatory);
    OptionBuilder.hasArg(aDataCheck != null);

    if (!aIsSingle) {
        OptionBuilder.withLongOpt(aSwitchName);
        lOption = OptionBuilder.create();
    } else {
        lOption = OptionBuilder.create(aSwitchName);
    }

    if (aDataCheck != null) {
        iParametersToCheck.add(aSwitchName);
        iParametersChecks.add(aDataCheck);
    }
    iOptions.addOption(lOption);
}

From source file:com.dtolabs.rundeck.ExpandRunServer.java

@SuppressWarnings("static-access")
public ExpandRunServer() {

    Option baseDir = OptionBuilder.withLongOpt("basedir").hasArg().withDescription("The basedir")
            .withArgName("PATH").create('b');

    Option serverDir = OptionBuilder.withLongOpt("serverdir").hasArg()
            .withDescription("The base directory for the server").withArgName("PATH").create();

    Option binDir = OptionBuilder.withLongOpt("bindir").hasArg().withArgName("PATH")
            .withDescription("The install directory for the tools used by users.").create('x');

    Option sbinDir = OptionBuilder.withLongOpt("sbindir").hasArg().withArgName("PATH")
            .withDescription("The install directory for the tools used by administrators.").create('s');

    Option configDir = OptionBuilder.withLongOpt("configdir").hasArg().withArgName("PATH")
            .withDescription("The location of the configuration.").create('c');

    Option dataDir = OptionBuilder.withLongOpt("datadir").hasArg().withArgName("PATH")
            .withDescription("The location of Rundeck's runtime data.").create();

    Option projectDir = OptionBuilder.withLongOpt("projectdir").hasArg().withArgName("PATH")
            .withDescription("The location of Rundeck's project data.").create('p');

    Option help = OptionBuilder.withLongOpt("help").withDescription("Display this message.").create('h');

    Option debugFlag = OptionBuilder.withDescription("Show debug information").create('d');

    Option skipInstall = OptionBuilder.withLongOpt(FLAG_SKIPINSTALL)
            .withDescription("Skip the extraction of the utilities from the launcher.").create();

    Option installonly = OptionBuilder.withLongOpt(FLAG_INSTALLONLY)
            .withDescription("Perform installation only and do not start the server.").create();

    options.addOption(baseDir);//from   w w  w  .ja v  a  2s  .  c om
    options.addOption(dataDir);
    options.addOption(serverDir);
    options.addOption(binDir);
    options.addOption(sbinDir);
    options.addOption(configDir);
    options.addOption(help);
    options.addOption(debugFlag);
    options.addOption(skipInstall);
    options.addOption(installonly);
    options.addOption(projectDir);

    debug = Boolean.getBoolean(SYS_PROP_RUNDECK_LAUNCHER_DEBUG);
    rewrite = Boolean.getBoolean(SYS_PROP_RUNDECK_LAUNCHER_REWRITE);
    useJaas = null == System.getProperty(SYS_PROP_RUNDECK_JAASLOGIN)
            || Boolean.getBoolean(SYS_PROP_RUNDECK_JAASLOGIN);
    runClassName = RUN_SERVER_CLASS;
    thisJar = thisJarFile();
    //load jar attributes
    final Attributes mainAttributes = getJarMainAttributes();
    if (null == mainAttributes) {
        throw new RuntimeException("Unable to load attributes");
    }

    versionString = mainAttributes.getValue(RUNDECK_VERSION);
    if (null != versionString) {
        DEBUG("Rundeck version: " + versionString);
    } else {
        throw new RuntimeException("Jar file attribute not found: " + RUNDECK_VERSION);
    }
    runClassName = mainAttributes.getValue(RUNDECK_START_CLASS);
    if (null == runClassName) {
        throw new RuntimeException("Jar file attribute not found: " + RUNDECK_START_CLASS);
    }
    jettyLibsString = mainAttributes.getValue(RUNDECK_JETTY_LIBS);
    if (null == jettyLibsString) {
        throw new RuntimeException("Jar file attribute not found: " + RUNDECK_JETTY_LIBS);
    }
    jettyLibPath = mainAttributes.getValue(RUNDECK_JETTY_LIB_PATH);
    if (null == jettyLibPath) {
        throw new RuntimeException("Jar file attribute not found: " + RUNDECK_JETTY_LIB_PATH);
    }
}

From source file:com.redhat.rhn.taskomatic.core.TaskomaticDaemon.java

private void createOption(Options accum, String longopt, boolean arg, String argName, String description) {
    OptionBuilder.withArgName(argName);/*from w w  w. j a  v  a  2 s .c  om*/
    OptionBuilder.withLongOpt(longopt);
    OptionBuilder.hasArg(arg);
    OptionBuilder.withDescription(description);
    Option option = OptionBuilder.create(longopt);
    accum.addOption(option);
    if (this.masterOptionsMap.get(longopt) == null) {
        this.masterOptionsMap.put(longopt, option);
    }
}

From source file:com.archivas.clienttools.arcmover.cli.ArcCopy.java

@SuppressWarnings({ "static-access", "AccessStaticViaInstance" })
public Options getOptions() {
    if (cliOptions == null) {
        Options options = new Options();

        // *** Adding a new option needs to be added to the cliOrder list
        // Note, you cannot do required options with this library and help so we have to add all
        // as non-required
        // and deal with it when parsing
        options.addOption(OptionBuilder.withDescription("Displays this help text (the default behavior).")
                .withLongOpt(HELP_OPTION).create("h"));

        // Required
        options.addOption(OptionBuilder.withArgName("source_profile").hasArg().withDescription(
                "Source for the copy operation: either a namespace profile name or LFS for the local file system.")
                .withLongOpt(SOURCE_PROFILE_OPTION).create("s"));
        options.addOption(OptionBuilder.withArgName("destination_profile").hasArg().withDescription(
                "Destination for the copy operation: either a namespace profile name or LFS for the local file system.")
                .withLongOpt(DESTINATION_PROFILE_OPTION).create("d"));
        options.addOption(OptionBuilder.withArgName("destination_path").hasArg()
                .withDescription("Destination directory path.").withLongOpt(DESTINATION_PATH_OPTION).create());

        // Optional
        options.addOption(OptionBuilder.withArgName("source_path").hasArg()
                .withDescription("Source directory path.").withLongOpt(SOURCE_PATH_OPTION).create());
        options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription(
                "Custom metadata path.  Can be relative or absolute.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(CUSTOM_METADATA_OPTION).create());

        options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription(
                "ACL path.  Can be relative or absolute.  This option applies only when copying from the local file system to a HCP 5.0 or later namespace.")
                .withLongOpt(ACL_OPTION).create());

        options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription(
                "Owner's name.  This option applies only when copying from the local file system to a HCP 5.0 or later namespace.")
                .withLongOpt(OWNER_OPTION).create());

        options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription(
                "Owner's domain.  This option applies only when copying from the local file system to a HCP 5.0 or later namespace.")
                .withLongOpt(DOMAIN_OPTION).create());

        options.addOption(OptionBuilder.withArgName("true|false").hasArg().withDescription(
                "Specifies whether copied objects should be marked for indexing.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(INDEX_OPTION).create());
        options.addOption(OptionBuilder.withArgName("true|false").hasArg().withDescription(
                "Specifies whether copied objects should be marked for shredding.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(SHRED_OPTION).create());
        options.addOption(OptionBuilder.withArgName("true|false").hasArg().withDescription(
                "Specifies whether copied objects should be placed on hold.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(HOLD_OPTION).create());
        options.addOption(OptionBuilder.withArgName("retention_setting").hasArg().withDescription(
                "Retention setting for copied objects.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(RETENTION_OPTION).create());
        options.addOption(OptionBuilder.withArgName("integer").hasArg().withDescription(
                "Group ID to use for the owner of copied objects.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(GID_OPTION).create());
        options.addOption(OptionBuilder.withArgName("integer").hasArg().withDescription(
                "User ID to use for the owner of copied objects.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(UID_OPTION).create());
        options.addOption(OptionBuilder.withArgName("octal_value").hasArg().withDescription(
                "POSIX permissions for copied objects; for example, 664.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(FILE_PERMS_OPTION).create());
        options.addOption(OptionBuilder.withArgName("octal_value").hasArg().withDescription(
                "POSIX permissions for new destination directories; for example, 664.  This option applies only when copying from the local file system to a namespace.")
                .withLongOpt(DIR_PERMS_OPTION).create());

        options.addOption(OptionBuilder.withArgName("job_name").hasOptionalArg().withDescription(
                "Reruns the copy job with the given job name if provide, if no name is provided it reruns the last copy job run.  When rerunning you can change the load and export settings.  Any changes to profiles, paths or metadata values will not change what is set in the job.")
                .withLongOpt(RERUN).create());
        options.addOption(OptionBuilder.withArgName("job_name").hasOptionalArg().withDescription(
                "Resumes the copy job from where it left off, if no name is provided it resumes the last copy job run.  When rerunning you can change the load and export settings.  Any changes to profiles, paths or metadata values will not change what is set in the job.")
                .withLongOpt(RESUME).create());
        options.addOption(OptionBuilder.withDescription("Treat conflict (409) failures as successes.")
                .withLongOpt(IGNORE_CONFLICTS).create());
        // results_types is only not shared because CONFLICT is not a valid option for delete
        // jobs//from w w  w  . ja va2  s.  c o  m
        options.addOption(OptionBuilder.withArgName("results_types").hasArg().withDescription(
                "Types of results lists to export: either ALL or a comma-separated list that includes one or more of SUCCESS, FAILURE, JOBLIST and CONFLICT.  If omitted no results lists are exported.")
                .withLongOpt(EXPORT_RESULTS_TYPE).create());
        getSharedOptions(options);

        cliOptions = options;
    }
    return cliOptions;
}

From source file:SearchApiExample.java

/**
  * Build command line options object./*from   ww w .  ja  v a 2s . c  o  m*/
  */
private static Options buildOptions() {

    Options opts = new Options();

    String helpMsg = "Print this message.";
    Option help = new Option(HELP_OPTION, helpMsg);
    opts.addOption(help);

    String consumerKeyMsg = "You API Consumer Key.";
    OptionBuilder.withArgName("consumerKey");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(consumerKeyMsg);
    Option consumerKey = OptionBuilder.create(CONSUMER_KEY_OPTION);
    opts.addOption(consumerKey);

    String consumerSecretMsg = "You API Consumer Secret.";
    OptionBuilder.withArgName("consumerSecret");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(consumerSecretMsg);
    Option consumerSecret = OptionBuilder.create(CONSUMER_SECRET_OPTION);
    opts.addOption(consumerSecret);

    String accessTokenMsg = "You OAuth Access Token.";
    OptionBuilder.withArgName("accessToken");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(accessTokenMsg);
    Option accessToken = OptionBuilder.create(ACCESS_TOKEN_OPTION);
    opts.addOption(accessToken);

    String tokenSecretMsg = "You OAuth Access Token Secret.";
    OptionBuilder.withArgName("accessTokenSecret");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(tokenSecretMsg);
    Option accessTokenSecret = OptionBuilder.create(ACCESS_TOKEN_SECRET_OPTION);
    opts.addOption(accessTokenSecret);

    OptionBuilder.withArgName("keywords");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("keywords");
    opts.addOption(OptionBuilder.create(KEYWORDS_OPTION));

    OptionBuilder.withArgName("name");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("name");
    opts.addOption(OptionBuilder.create(NAME_OPTION));

    OptionBuilder.withArgName("company");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("company");
    opts.addOption(OptionBuilder.create(COMPANY_OPTION));

    OptionBuilder.withArgName("current-company");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("current-company");
    opts.addOption(OptionBuilder.create(CURRENT_COMPANY_OPTION));

    OptionBuilder.withArgName("title");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("title");
    opts.addOption(OptionBuilder.create(TITLE_OPTION));

    OptionBuilder.withArgName("current-title");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("current-title");
    opts.addOption(OptionBuilder.create(CURRENT_TITLE_OPTION));

    OptionBuilder.withArgName("industry-code");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("industry-code");
    opts.addOption(OptionBuilder.create(INDUSTRY_CODE_OPTION));

    OptionBuilder.withArgName("search-location-type");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("search-location-type");
    opts.addOption(OptionBuilder.create(SEARCH_LOCATION_TYPE_OPTION));

    OptionBuilder.withArgName("country-code");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("country-code");
    opts.addOption(OptionBuilder.create(COUNTRY_CODE_OPTION));

    OptionBuilder.withArgName("postal-code");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("postal-code");
    opts.addOption(OptionBuilder.create(POSTAL_CODE_OPTION));

    OptionBuilder.withArgName("network");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("network");
    opts.addOption(OptionBuilder.create(NETWORK_OPTION));

    return opts;
}

From source file:com.github.errantlinguist.latticevisualiser.ArgParser.java

/**
 * Creates and adds a horizontal size option to a given {@link Options}
 * object./*from   w ww.ja  v  a 2 s  . co  m*/
 * 
 * @param options
 *            The <code>Options</code> object to add to.
 */
private static void addXSizeOption(final Options options) {
    OptionBuilder.withLongOpt(WIDTH_KEY_LONG);
    OptionBuilder.withDescription(WIDTH_DESCR);
    OptionBuilder.hasArg();
    OptionBuilder.withArgName(SIZE_ARG_NAME);
    OptionBuilder.withType(Integer.class);

    final Option width = OptionBuilder.create(WIDTH_KEY);
    options.addOption(width);
}

From source file:cmd.ArgumentHandler.java

/**
 * Parses the options in the command line arguments and returns an array of
 * strings corresponding to the filenames given as arguments only
 *
 * @param args/*from   w w  w .j a va2  s  .  com*/
 * @throws org.apache.commons.cli.ParseException
 */
@SuppressWarnings("static-access")
public void parseCommandLineOptions(String[] args) throws ParseException {

    options = new Options();

    options.addOption("h", "help", false, "Help page for command usage");

    options.addOption("s", false, "SubStructure detection");

    options.addOption("a", false, "Add Hydrogen");

    options.addOption("x", false, "Match Atom Type");

    options.addOption("r", false, "Remove Hydrogen");

    options.addOption("z", false, "Ring matching");

    options.addOption("b", false, "Match Bond types (Single, Double etc)");

    options.addOption(
            OptionBuilder.hasArg().withDescription("Query filename").withArgName("filepath").create("q"));

    options.addOption(
            OptionBuilder.hasArg().withDescription("Target filename").withArgName("filepath").create("t"));

    options.addOption(OptionBuilder.hasArg().withDescription("Add suffix to the files").withArgName("suffix")
            .create("S"));

    options.addOption("g", false, "create png of the mapping");

    options.addOption(OptionBuilder.hasArg().withDescription("Dimension of the image in pixels")
            .withArgName("WIDTHxHEIGHT").create("d"));

    options.addOption("m", false, "Report all Mappings");

    String filterDescr = "Default: 0, Stereo: 1, " + "Stereo+Fragment: 2, Stereo+Fragment+Energy: 3";
    options.addOption(OptionBuilder.hasArg().withDescription(filterDescr).withArgName("number").create("f"));

    options.addOption("A", false, "Appends output to existing files, else creates new files");

    options.addOption(OptionBuilder.withDescription("Do N-way MCS on the target SD file").create("N"));

    options.addOption(OptionBuilder.hasArg().withDescription("Query type (MOL, SMI, etc)").withArgName("type")
            .create("Q"));

    options.addOption(OptionBuilder.hasArg().withDescription("Target type (MOL, SMI, SMIF, etc)")
            .withArgName("type").create("T"));

    options.addOption(OptionBuilder.hasArg().withDescription("Output the substructure to a file")
            .withArgName("filename").create("o"));

    options.addOption(
            OptionBuilder.hasArg().withDescription("Output type (SMI, MOL)").withArgName("type").create("O"));

    options.addOption(OptionBuilder.hasOptionalArgs(2).withValueSeparator().withDescription("Image options")
            .withArgName("option=value").create("I"));

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

    if (line.hasOption('Q')) {
        queryType = line.getOptionValue("Q");
    } //else {
    //            queryType = "MOL";
    //        } //XXX default type?

    if (line.hasOption('T')) {
        targetType = line.getOptionValue("T");
    } else {
        targetType = "MOL";
    }

    if (line.hasOption('a')) {
        this.setApplyHAdding(true);
    }

    if (line.hasOption('r')) {
        this.setApplyHRemoval(true);
    }

    if (line.hasOption('m')) {
        this.setAllMapping(true);
    }

    if (line.hasOption('s')) {
        this.setSubstructureMode(true);
    }

    if (line.hasOption('g')) {
        this.setImage(true);
    }

    if (line.hasOption('b')) {
        this.setMatchBondType(true);
    }

    if (line.hasOption('z')) {
        this.setMatchRingType(true);
    }

    if (line.hasOption('x')) {
        this.setMatchAtomType(true);
    }

    remainingArgs = line.getArgs();

    if (line.hasOption('h') || line.getOptions().length == 0) {
        //            System.out.println("Hello");
        helpRequested = true;
    }

    if (line.hasOption('S')) {
        String[] suffix_reader = line.getOptionValues('S');
        if (suffix_reader.length < 1) {
            System.out.println("Suffix required!");
            helpRequested = true;
        }
        setSuffix(suffix_reader[0]);
        setApplySuffix(true);
    }

    if (line.hasOption('f')) {
        String[] filters = line.getOptionValues('f');
        if (filters.length < 1) {
            System.out.println("Chemical filter required (Ranges: 0 to 3)!");
            helpRequested = true;
        }
        setChemFilter((int) new Integer(filters[0]));
    }

    if (line.hasOption('q')) {
        queryFilepath = line.getOptionValue('q');
    }

    if (line.hasOption('t')) {
        targetFilepath = line.getOptionValue('t');
    }

    if (line.hasOption("A")) {
        this.setAppendMode(true);
    }

    if (line.hasOption("N")) {
        setNMCS(true);
    }

    if (line.hasOption("o")) {
        outputSubgraph = true;
        outputFilepath = line.getOptionValue("o");
    }

    if (line.hasOption("O")) {
        outputFiletype = line.getOptionValue("O");
    } else {
        outputFiletype = "MOL";
    }

    if (line.hasOption("d")) {
        String dimensionString = line.getOptionValue("d");
        if (dimensionString.contains("x")) {
            String[] parts = dimensionString.split("x");
            try {
                setImageWidth(Integer.parseInt(parts[0]));
                setImageHeight(Integer.parseInt(parts[1]));
                System.out.println("set image dim to " + getImageWidth() + "x" + getImageHeight());
            } catch (NumberFormatException nfe) {
                throw new ParseException("Malformed dimension string " + dimensionString);
            }
        } else {
            throw new ParseException("Malformed dimension string " + dimensionString);
        }
    }

    if (line.hasOption("I")) {
        imageProperties = line.getOptionProperties("I");
        if (imageProperties.isEmpty()) {
            // used just "-I" by itself
            isImageOptionHelp = true;
        }
    }
}

From source file:com.google.api.ads.adwords.awreporting.server.AwReportingServer.java

/**
 * Creates the command line options.//from   w  w  w .  j  a  v  a  2s. co m
 *
 * @return the {@link Options}.
 */
private static Options createCommandLineOptions() {

    Options options = new Options();
    Option help = new Option("help", "print this message");
    options.addOption(help);

    OptionBuilder.withArgName("startServer");
    OptionBuilder.hasArg(false);
    OptionBuilder.withDescription("Starts the Rest Server. No dates required");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("startServer"));

    OptionBuilder.withArgName("processKratus");
    OptionBuilder.hasArg(false);
    OptionBuilder
            .withDescription("Process Kratus processes the 7 reports peraccount and creates a daily Kratu");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("processKratus"));

    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("aw-reporting-server-sample.properties file "
            + " (./aw-reporting-server-sample.properties by default if not provided)");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("file"));

    OptionBuilder.withArgName("YYYYMMDD");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("Start date for CUSTOM_DATE Reports (YYYYMMDD)");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("startDate"));

    OptionBuilder.withArgName("YYYMMDD");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("End date for CUSTOM_DATE Reports (YYYYMMDD)");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("endDate"));

    OptionBuilder.withArgName("DateRangeType");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("ReportDefinitionDateRangeType");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("dateRange"));

    OptionBuilder.withArgName("accountIdsFile");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("Consider ONLY the account IDs specified on the file to run the report");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("accountIdsFile"));

    OptionBuilder.withArgName("verbose");
    OptionBuilder.hasArg(false);
    OptionBuilder.withDescription("The application will print all the tracing on the console");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("verbose"));

    OptionBuilder.withArgName("debug");
    OptionBuilder.hasArg(false);
    OptionBuilder.withDescription(
            "Will display all the debug information. " + "If the option 'verbose' is activated, "
                    + "all the information will be displayed on the console as well");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("debug"));

    return options;
}

From source file:com.google.api.ads.adwords.jaxws.extensions.kratu.KratuMain.java

/**
 * Creates the command line options./*from   www .  j a v a  2s . c  o m*/
 *
 * @return the {@link Options}.
 */
private static Options createCommandLineOptions() {

    Options options = new Options();
    Option help = new Option("help", "print this message");
    options.addOption(help);

    OptionBuilder.withArgName("startServer");
    OptionBuilder.hasArg(false);
    OptionBuilder.withDescription("Starts the Rest Server. No dates required");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("startServer"));

    OptionBuilder.withArgName("processKratus");
    OptionBuilder.hasArg(false);
    OptionBuilder
            .withDescription("Process Kratus processes the 7 reports peraccount and creates a daily Kratu");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("processKratus"));

    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("kratubackend-sample.properties file "
            + " (./kratubackend-sample.properties by default if not provided)");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("file"));

    OptionBuilder.withArgName("YYYYMMDD");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("Start date for CUSTOM_DATE Reports (YYYYMMDD)");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("startDate"));

    OptionBuilder.withArgName("YYYMMDD");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("End date for CUSTOM_DATE Reports (YYYYMMDD)");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("endDate"));

    OptionBuilder.withArgName("DateRangeType");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("ReportDefinitionDateRangeType");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("dateRange"));

    OptionBuilder.withArgName("accountIdsFile");
    OptionBuilder.hasArg(true);
    OptionBuilder.withDescription("Consider ONLY the account IDs specified on the file to run the report");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("accountIdsFile"));

    OptionBuilder.withArgName("verbose");
    OptionBuilder.hasArg(false);
    OptionBuilder.withDescription("The application will print all the tracing on the console");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("verbose"));

    OptionBuilder.withArgName("debug");
    OptionBuilder.hasArg(false);
    OptionBuilder.withDescription(
            "Will display all the debug information. " + "If the option 'verbose' is activated, "
                    + "all the information will be displayed on the console as well");
    OptionBuilder.isRequired(false);
    options.addOption(OptionBuilder.create("debug"));

    return options;
}