Skip to content

Add an addRequiredOption method#7

Closed
jrRibeiro wants to merge 1 commit into
apache:trunkfrom
jrRibeiro:add-required-option
Closed

Add an addRequiredOption method#7
jrRibeiro wants to merge 1 commit into
apache:trunkfrom
jrRibeiro:add-required-option

Conversation

@jrRibeiro

Copy link
Copy Markdown

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 .." );

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

britter commented Jul 27, 2016

Copy link
Copy Markdown
Member

I have created https://issues.apache.org/jira/browse/CLI-267 for you.

@britter

britter commented Jul 27, 2016

Copy link
Copy Markdown
Member

Fixed in svn and will sync to github shortly. Thank you!

@asfgit asfgit closed this in 5d1d967 Jul 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants