[ 
https://issues.apache.org/jira/browse/CLI-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615936#action_12615936
 ] 

Andrew Shirley commented on CLI-124:
------------------------------------

The original report was concerning the output of the HelpFormatter (which 
shouldn't suggest B is optional if it isn't). There is a seperate question of 
whether the constraints we can apply to options are sufficient. 

By drawing analogy to XML schema, a minOccurs of 1 on A would mean that /for 
each/ B, there must be at least one A. a document would still be valid if it 
contained no Bs (assuming no other rules on B).
It seems that Options aren't stored in a properly heirarchical way and that 
setting a minimum on A applies globally (i.e. A must be specified on the 
command line that many times (regardless of how many times B is present). I 
think it would be a major overhaul to support heirarchical semantics however it 
might be possible to do something.
Unfortunatly, I havn't worked on CLI for a long time (and havn't even been 
keeping up with the mailing lists recently) and so I don't have any suggestions 
as to what could be usefully done (or how to do it).

If someone thinks this would be a useful addition, can I suggest opening a new 
enhancement bug for this issue (could I be added to the CC if this happens 
please.)

> HelpFormatter should be more cunning when deciding if a Group is Optional and 
> therefore square-bracketing it
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CLI-124
>                 URL: https://issues.apache.org/jira/browse/CLI-124
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-2.x
>            Reporter: Andrew Shirley
>             Fix For: 2.0
>
>
> Currently all child groups are required to satisfy their constraints (defaul 
> is any thing goes) and so if you have a Group A as a child of Group B and set 
> a minimum of 1 on A then B is no longer Optional as A is not Optional.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to