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:34:20 UTC

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

Benedikt Ritter created CLI-267:
-----------------------------------

             Summary: 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
             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)