commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrRibeiro <...@git.apache.org>
Subject [GitHub] commons-cli pull request #7: Add an addRequiredOption method
Date Thu, 21 Jul 2016 17:24:45 GMT
GitHub user jrRibeiro opened a pull request:

    https://github.com/apache/commons-cli/pull/7

    Add an addRequiredOption method

    This pull request adds an addRequiredOption method, which creates an Option with setRequired(true).
    
    This is really useful, given the amount of projects I saw doing things like:
    
    ```
    Options options = new Options();
    options.addOption( "a", "all", false, "do not hide entries starting with ." );
    options.addOption( "A", "almost-all", false, "do not list implied . and .." );
    options.addOption( "b", "escape", false, "print octal escapes for nongraphic " + "characters"
);
    // ... more addOptions like these and then
    Option stuff = new Option( "c", "stuff", true, "do not list implied . and .." );
    stuff.setRequired(true);
    options.addOption( stuff );
    // And many more required options like this one
    ```
    This pull request proposes an auxiliary method to create a required option, so that these
options could just be added with.
    
    `options.addRequiredOption( "c", "stuff", true, "do not list implied . and .." );`

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jrRibeiro/commons-cli add-required-option

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-cli/pull/7.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #7
    
----
commit 42d9d436019a87fef9ad20e7763dffa3207328ac
Author: Ricardo Ribeiro <j.ribeiro.fafe@gmail.com>
Date:   2016-07-21T17:13:53Z

    Add an addRequiredOption method
    
    Add addRequiredOption, which creates an Option with setRequired(true)

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message