commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Shirley <>
Subject Re: [CLI] Required and Optional Groups
Date Thu, 27 Jul 2006 11:25:50 GMT
On Wed, Jul 26, 2006 at 10:06:09PM -0700, Miguel Muñoz wrote:
> Comrades,
>   I want to use CLI 2.0 to create command line options that look like this:
> ShellCommand -DB|-SCM|-SCW [-s <source>]
> I'm adding three DefaultOptions to a group to get the first set (-DB|-SCM|-SCW), but
the trouble is, the user is required to specify one of 
> the three, but I can't figure out a way to make this group required. Consequently, I'm
getting this:
> ShellCommand [-DB|-SCM|-SCW] [-s <source>]
> This is not what I want.
> Is there any way to do this?

hi, you should be able to set a minimum number of children needed to
satisfy the group i.e. 1 in this case. This can be done in the
constructor of GroupImpl or if you are using the GroupBuilder
(recommended) then call .withMinimum(1) before .create()

If they have to specify exactly 1, then you will need .withMaximum(1)
as well, otherwise "-DB -SCM -s foo" would be accepted.

hope this helps

Andrew Shirley

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message