commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Sirianni" <eric.siria...@gmail.com>
Subject Re: [CLI]: Can have two group options with an option with the same shortname?
Date Fri, 30 Jun 2006 13:22:09 GMT
Thanks for the quick reply!

I wasn't aware that description was a unique key for distinguishing
attributes.  Its fine for me as a quick fix but I agree with your long
term assessment that the semantics should be reevaluated.

Thanks,
Eric

On 6/30/06, Andrew Shirley <aks@decisionsoft.co.uk> wrote:
> On Thu, Jun 29, 2006 at 01:41:20PM -0400, Eric Sirianni wrote:
> > This doesn't seem to work.  Consider the following example:
>
> >
> > Is there a way to express my desired syntax using common-cli?  Namely,
> > I want to be able to have two groups with the same shortnamed option.
> > The groups may or may not be mutually exclusive.
>
> This doesn't work because nameOption.equals(dbNameOption) == true and so
> foo is registered as a value with that option, it has a maximum of 1
> (default) and so when another comes along (bar) it isn't processed.
>
> If you make the two different (by giving them a different description,
> say) then the code you gave will work.
>
>
>        DefaultOption nameOption =
> defaultOptionBuilder.withDescription("desc").withShortName("name").withArgument(nameArgument).withRequired(true).create();
>
>        DefaultOption dbNameOption =
> defaultOptionBuilder.withDescription("different").withShortName("name").withArgument(dbNameArgument).withRequired(true).create();
>
>
> This is obviously not a state we should be in and so i suggest we look
> at all of the equals and hashcode methods to make sure they are correct.
>
> Andrew Shirley
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message