Re: Commons CLI

2007-07-23 Thread Henri Yandell

On 7/22/07, Russel Winder <[EMAIL PROTECTED]> wrote:

On Fri, 2007-07-20 at 16:04 -0700, Henri Yandell wrote:
> Sorry for the delay Russel;

I was wondering how long to wait before reposting ;-)

Thanks for getting on to this.

> I don't know of any reason for getOptionValues to have changed - could
> you open a JIRA issue on it?
>
> http://issues.apache.org/jira/browse/CLI

OK, I will create some test cases to show the problem and put them on
the page.

Is there a possibility of 1.1.x being released with bug fixes?


Definitely.

Hen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Commons CLI

2007-07-22 Thread Russel Winder
On Fri, 2007-07-20 at 16:04 -0700, Henri Yandell wrote:
> Sorry for the delay Russel;

I was wondering how long to wait before reposting ;-)

Thanks for getting on to this.

> I don't know of any reason for getOptionValues to have changed - could
> you open a JIRA issue on it?
> 
> http://issues.apache.org/jira/browse/CLI

OK, I will create some test cases to show the problem and put them on
the page.  

Is there a possibility of 1.1.x being released with bug fixes?

Thanks.
-- 
Russel.

Dr Russel Winder
41 Buckmaster Road   m: +44 7770 465 077
London SW11 1EN, UK  t: +44 20 7585 2200


signature.asc
Description: This is a digitally signed message part


Re: Commons CLI

2007-07-20 Thread Henri Yandell

Sorry for the delay Russel;

I don't know of any reason for getOptionValues to have changed - could
you open a JIRA issue on it?

http://issues.apache.org/jira/browse/CLI

On 7/16/07, Russel Winder <[EMAIL PROTECTED]> wrote:

The Groovy project currently uses Commons CLI 1.0, we thought we ought
to upgrade to 1.1 given this is the official public release.  However,
from what I can see, whilst CommandLine.getOptionValues works on 1.0, it
seems not to work on 1.1.  The release notes for 1.1 indicate this is a
bug fix release but is it the case that the semantics for
getOptionValues changed in some way.

Thanks.

--
Russel.

Dr Russel Winder+44 20 7585 2200
41 Buckmaster Road  +44 7770 465 077
London SW11 1EN, UK [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [CLI] Options with multiple arguments (was Re: commons cli)

2004-09-07 Thread max haeussler
Hi Rob,

hey thanks for your long reply, I really didn't expect that at the
moment...anyways, I'm using cli 1 now, simply doing the check myself. It's
not nice, neither anything close to good design, but it works for the
moment. As soon as the things break up, when I'm adding more options (as
usual...) I will try out the code you sent me. At the moment, I'm just glad
everything starts up and keeps going for a while...

Max
- Original Message - 
From: "Rob Oxspring" <[EMAIL PROTECTED]>
To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, September 01, 2004 10:39 PM
Subject: [CLI] Options with multiple arguments (was Re: commons cli)


> Hi,
>
> This is the right list :)
>
> I can't think of anyway to tackle this with CLI1, and the problem wasn't
> considered when designing CLI2 either.  However you should be able to
> work around things if your willing to try a CLI2 snapshot.*
>
> CLI2 is still limitted to having a single argument per option but does
> allow 'child' options.  A -linelength child option would only be valid
> following a -print option and both the child and parent would have an
> argument, the output of HelpFormatter tries to make this relationship
> clear to the user.  I would recommend this solution as it allows for
> easier future expansion (-justify?, -margin?) but the following work
> around should get you closer to the desired result:
>
>// not tested but it should give you a starting point
>
>// grab some builders
>ArgumentBuilder aBuilder = new ArgumentBuilder();
>GroupBuilder gBuilder = new GroupBuilder();
>DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
>
>// build the two arguments
>Argument textfile = aBuilder.withName("textfile").create();
>Argument linelength = aBuilder.withName("linelength").create();
>// create a group containing those arguments
>Group children = gBuilder
>.withOption(textfile)
>.withOption(linelength)
>.create();
>// create the print option
>Option print = oBuilder
>.withShortName("print")
>.withChildren(args)
>.create();
>
> Hope that helps,
>
> Rob
>
> * Unofficial beta available from
> http://www.apache.org/~roxspring/cli/distributions/ until I sort out the
> official one.
>
> Maximilian Haeussler wrote:
>
> > Hallo,
> >
> > I couldn't find a mainling list for commons cli. Therefore I'm sending
> > the question to you: How can I build an option with multiple arguments??
> > And how do I later retreive the values? I don't understand the
> > sourcecode sufficiently. Apart from that, when i set .hasArgs(2) for an
> > option built by the optionbuilder, helpformatter doesn't reflect this in
> > any way, only the last option is printed in the help text.
> >
> > I want something like "-print  " but this is far
> > from obvious after having read the documentation.
> >
> > I don't want to introduce an new option "-print  -linelength
> > " as -linelength applies only to the "-print" option and to no
> > other options.
> >
> > Thanks!
> >
> > Max
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[CLI] Options with multiple arguments (was Re: commons cli)

2004-09-01 Thread Rob Oxspring
Hi,
This is the right list :)
I can't think of anyway to tackle this with CLI1, and the problem wasn't 
considered when designing CLI2 either.  However you should be able to 
work around things if your willing to try a CLI2 snapshot.*

CLI2 is still limitted to having a single argument per option but does 
allow 'child' options.  A -linelength child option would only be valid 
following a -print option and both the child and parent would have an 
argument, the output of HelpFormatter tries to make this relationship 
clear to the user.  I would recommend this solution as it allows for 
easier future expansion (-justify?, -margin?) but the following work 
around should get you closer to the desired result:

  // not tested but it should give you a starting point
  // grab some builders
  ArgumentBuilder aBuilder = new ArgumentBuilder();
  GroupBuilder gBuilder = new GroupBuilder();
  DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
  // build the two arguments
  Argument textfile = aBuilder.withName("textfile").create();
  Argument linelength = aBuilder.withName("linelength").create();
  // create a group containing those arguments
  Group children = gBuilder
  .withOption(textfile)
  .withOption(linelength)
  .create();
  // create the print option
  Option print = oBuilder
  .withShortName("print")
  .withChildren(args)
  .create();
Hope that helps,
Rob
* Unofficial beta available from 
http://www.apache.org/~roxspring/cli/distributions/ until I sort out the 
official one.

Maximilian Haeussler wrote:
Hallo,
I couldn't find a mainling list for commons cli. Therefore I'm sending 
the question to you: How can I build an option with multiple arguments??
And how do I later retreive the values? I don't understand the 
sourcecode sufficiently. Apart from that, when i set .hasArgs(2) for an 
option built by the optionbuilder, helpformatter doesn't reflect this in 
any way, only the last option is printed in the help text.

I want something like "-print  " but this is far 
from obvious after having read the documentation.

I don't want to introduce an new option "-print  -linelength 
" as -linelength applies only to the "-print" option and to no 
other options.

Thanks!
Max
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: commons-cli processing options incorrectly?

2004-07-19 Thread Andrew Ferguson
this also seems to happen with the current cvs image - I'm not sure what
the CLI 2.0 classes are though - is anyone still working on the pre-2.0
classes?

-Original Message-
From: Andrew Ferguson [mailto:[EMAIL PROTECTED] 
Sent: 15 July 2004 18:40
To: Jakarta Commons Users List
Subject: commons-cli processing options incorrectly?

hi,

 this could be me misunderstanding the posix standard but this link


http://java.sun.com/docs/books/tutorial/essential/attributes/_posix.html

 says 

"Options that do not require arguments can be grouped after a
hyphen, so, for example, -lst is equivalent to -t -l -s."


 but the following code:

import org.apache.commons.cli.*;
import java.util.*;

public class CLITest {
public static void main(String[]arg) throws Exception {
CommandLineParser parser = new PosixParser();

Options options = new Options();

Option p = new Option("p", "pets", true, "takes
a list of up to 4 animals");
p.setArgs(4);
p.setRequired(true);

Option v = new Option("v", "vet", true, "the
name of a vet");
v.setArgs(100);
v.setRequired(true);

options.addOption(p).addOption(v);

CommandLine line = parser.parse(options, arg);

System.out.println("p ? "+line.hasOption("p")+"
"+Arrays.asList(line.getOptionValues("p")));
System.out.println("v ? "+line.hasOption("v")+"
"+Arrays.asList(line.getOptionValues("v")));
}
}

 produces these results

y:\java\misc>java CLITest -p 1 2 3 -v 4 5 6
p ? true [1, 2, 3]
v ? true [4, 5, 6]

y:\java\misc>java CLITest -p 1 2 v 3 -v 4 5 6
p ? true [1, 2]
v ? true [4, 5, 6]

y:\java\misc>java CLITest -p 1 v 2 3 -v 4 5 6
p ? true [1]
v ? true [4, 5, 6]

y:\java\misc>java CLITest -p 1 V 2 3 -v 4 5 6
p ? true [1, V, 2, 3]
v ? true [4, 5, 6]

 when I was expecting: (* marks different from above)

y:\java\misc>java CLITest -p 1 2 3 -v 4 5 6
p ? true [1, 2, 3]
v ? true [4, 5, 6]

y:\java\misc>java CLITest -p 1 2 v 3 -v 4 5 6
*   p ? true [1, 2, v, 3] 
v ? true [4, 5, 6]

y:\java\misc>java CLITest -p 1 v 2 3 -v 4 5 6
*   p ? true [1, v, 2, 3]
v ? true [4, 5, 6]

y:\java\misc>java CLITest -p 1 V 2 3 -v 4 5 6
p ? true [1, V, 2, 3]
v ? true [4, 5, 6]

I'm constantly misunderstanding how command lines are meant to be
interpreted, but this seems wrong??

thanks,
Andrew

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: commons-cli support for subcommands?

2004-02-13 Thread John Keyes
I know that readers of this list are wondering if it will ever
be released by there is support for subcommands in CLI 2
which is under (*active*) development.  We'll announce when it
is a candidate is available.
-John K

On 13 Feb 2004, at 03:07, Wallace, Hank wrote:

I am just getting started with commons-cli, but can't find an elegant 
way to
support subcommands in addition to options.  Can someone point me in 
the
right direction?

Thanks,
Hank
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: commons-cli support for subcommands?

2004-02-13 Thread John Keyes
I know that readers of this list are wondering if it will ever
be released by there is support for subcommands in CLI 2
which is under (*active*) development.  We'll announce when it
is a candidate is available.
-John K

On 13 Feb 2004, at 03:07, Wallace, Hank wrote:

I am just getting started with commons-cli, but can't find an elegant 
way to
support subcommands in addition to options.  Can someone point me in 
the
right direction?

Thanks,
Hank
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Commons-CLI Builds

2002-10-17 Thread John Keyes

Joe,

This project is alive and well.  The 1.0 release should happen
soon.  When it is released the list will be notified.  If you
want to get the HEAD it will work fine.  There are nightly
builds happening now also and they will be available from
http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-cli/

-John K

On Thu, 2002-10-17 at 02:53, joe mcglynn wrote:
> I'm looking for the "cli" builds, but don't see it under either
> "release" or "nightly" (empty directory only).  I didn't see any entries
> in scarab, but there appears to be active work.  It _is_ listed as a
> live part of commons (i.e. not in the sandbox)
> 
> Can anyone tell me the state of this project?  Should I just get the
> source from the tip of the CVS tree?  Is there a known-good label?
> 
> Thanks,
> Joe
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
-- 
John Keyes <[EMAIL PROTECTED]>


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




Re: Commons-CLI Builds

2002-10-16 Thread Craig R. McClanahan



On Wed, 16 Oct 2002, joe mcglynn wrote:

> Date: Wed, 16 Oct 2002 18:53:01 -0700
> From: joe mcglynn <[EMAIL PROTECTED]>
> Reply-To: Jakarta Commons Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Commons-CLI Builds
>
> I'm looking for the "cli" builds, but don't see it under either
> "release" or "nightly" (empty directory only).  I didn't see any entries
> in scarab, but there appears to be active work.  It _is_ listed as a
> live part of commons (i.e. not in the sandbox)
>
> Can anyone tell me the state of this project?  Should I just get the
> source from the tip of the CVS tree?  Is there a known-good label?
>

A build issue got cleaned up just today, so there should be nightly builds
starting tonight (the job runs at 3am Pacific Time).

> Thanks,
> Joe

Craig


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