[jira] [Commented] (CLI-285) Multiple Options in Option Group

2024-03-07 Thread Claude Warren (Jira)


[ 
https://issues.apache.org/jira/browse/CLI-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17824636#comment-17824636
 ] 

Claude Warren commented on CLI-285:
---

Upon further reflection I think that to complete the set of check of valid 
option conditions, it is necessary to have a "requires" field that will accept 
either an OptionsCollection or an Option.  In this case the option would only 
be valid if the requires were also valid and present.

> 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 ] [ -c  ] | [ -d  ] | [ -e  ]]
> So these would be valid:
> -b 
> -c 
> -b  -c 
> -d 
> -e 
> The "-d", "-e", and "-b -c" are mutually exclusive



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CLI-285) Multiple Options in Option Group

2024-03-07 Thread Claude Warren (Jira)


[ 
https://issues.apache.org/jira/browse/CLI-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 ] [ -c  ] | [ -d  ] | [ -e  ]]
> So these would be valid:
> -b 
> -c 
> -b  -c 
> -d 
> -e 
> The "-d", "-e", and "-b -c" are mutually exclusive



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CLI-285) Multiple Options in Option Group

2020-06-04 Thread Jira


[ 
https://issues.apache.org/jira/browse/CLI-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17126043#comment-17126043
 ] 

Alexander Schäl commented on CLI-285:
-

My application can work in two different modes {{migrate}} and {{repair}}, 
which can be selected via the command line option {{--function}}.

Depending on the selected function, two _different_ groups of mandatory and 
optional parameters should be used.

Expressed in the above notation, for example
{noformat}
[--function migrate --source  --target  [--legacy]]|[--function 
repair --system  [--startDate ]] {noformat}

The {{parse}} method should recognize wrong usage and the {{printHelp}} method 
should visualize these combinations in a reasonable way.

 

_Please_ reactivate this old issue :D

> 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 ] [ -c  ] | [ -d  ] | [ -e  ]]
> So these would be valid:
> -b 
> -c 
> -b  -c 
> -d 
> -e 
> The "-d", "-e", and "-b -c" are mutually exclusive



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (CLI-285) Multiple Options in Option Group

2018-10-11 Thread Thomas P (JIRA)


[ 
https://issues.apache.org/jira/browse/CLI-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646934#comment-16646934
 ] 

Thomas P commented on CLI-285:
--

In my view the object mane _OptionGroup_ is missleading and I'd rather concider 
a group of options to depend on each other. But for the time being that's what 
we have.

I suggest to call the new Feature an *OptionList* which can be added to an 
_OptionGroup._

 

I'd also volonteer to implement that.

> 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 ] [ -c  ] | [ -d  ] | [ -e  ]]
> So these would be valid:
> -b 
> -c 
> -b  -c 
> -d 
> -e 
> The "-d", "-e", and "-b -c" are mutually exclusive



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)