Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Placeholder issue for https://github.com/apache/commons-cli/pull/7
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 oneThis 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 .." );