You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2016/07/27 18:41:20 UTC

[jira] [Resolved] (CLI-267) Add an addRequiredOption method to Options

     [ https://issues.apache.org/jira/browse/CLI-267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benedikt Ritter resolved CLI-267.
---------------------------------
    Resolution: Fixed

{code}
$ svn ci -m "CLI-267: Add an addRequiredOption method to Options. Thanks to Ricardo Ribeiro. This also closes #7 from GitHub."
Sending        src/changes/changes.xml
Sending        src/main/java/org/apache/commons/cli/Options.java
Transmitting file data ..done
Committing transaction...
Committed revision 1754329.
{code}

> Add an addRequiredOption method to Options
> ------------------------------------------
>
>                 Key: CLI-267
>                 URL: https://issues.apache.org/jira/browse/CLI-267
>             Project: Commons CLI
>          Issue Type: New Feature
>          Components: Options definition
>            Reporter: Benedikt Ritter
>            Assignee: Benedikt Ritter
>              Labels: github
>             Fix For: 1.4
>
>
> Placeholder issue for https://github.com/apache/commons-cli/pull/7
> {quote}
> 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:
> {code}
> 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
> {code}
> This pull request proposes an auxiliary method to create a required option, so that these options could just be added with.
> {code}
> options.addRequiredOption( "c", "stuff", true, "do not list implied . and .." );
> {code}
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)