[
https://issues.apache.org/jira/browse/CLI-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17824298#comment-17824298
]
Claude Warren commented on CLI-285:
-----------------------------------
First, let's introduce the Interface OptionCollection – Simply a collection of
options with methods to add "Option" and "OptionCollection" object to the
collection and "boolean isValid()" a method to indicate that some internal
reasoning about validity of the internal state.
If we think about the "Options" class as an OptionCollection where
isValid(CommandLine) returns true as long as there are no unpopulated required
Option or OptionGroups.
We can also think of OptionGroup as an instance of OptionCollection where
isValid(CommandLine) returns true if only one contained Option or
OptionCollection objects is valid.
Then we can create a total of three OptionCollection implementations.
RequireAll: isValid(CommandLine) returns true if all the contained Option or
OptionCollection objects are valid.
RequireOne: a synonym for the current OptionGroup
RequireNone: isValid(CommandLine) returns true if all the contained Options or
OptionsCollection objects are not valid.
The changes to the internal code will be to replace all "OptionGroup"
parameters with OptionCollection types.
Implement the 3 RequireX instances of OptionCollection
deprecate OptionGroup and reimplement it as subclass of RequireOne.
extend Options to implement OptionCollection.
I think this will address the issues with CLI-285
> Multiple Options in Option Group
> --------------------------------
>
> Key: CLI-285
> URL: https://issues.apache.org/jira/browse/CLI-285
> Project: Commons CLI
> Issue Type: Improvement
> Components: CLI-1.x
> Reporter: Richard Kao
> Priority: Major
>
> Allow the creation of multiple Options with in an OptionGroup so something
> like the following can be created:
> [ -a ] [ [ -b <arg>] [ -c <arg> ] | [ -d <arg> ] | [ -e <arg> ]]
> So these would be valid:
> -b <arg>
> -c <arg>
> -b <arg> -c <arg>
> -d <arg>
> -e <arg>
> The "-d", "-e", and "-b -c" are mutually exclusive
--
This message was sent by Atlassian Jira
(v8.20.10#820010)