4 messages in org.codehaus.groovy.user[groovy-user] How much of CliBuilder ...
FromSent OnAttachments
Bogdan CalmacMar 17, 2008 5:55 pm 
Gerrit GeensMar 18, 2008 12:05 am 
Russel WinderMar 18, 2008 12:33 am 
Russel WinderMar 18, 2008 12:40 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[groovy-user] How much of CliBuilder does work?Actions...
From:Bogdan Calmac (bcal@gmail.com)
Date:Mar 17, 2008 5:55:11 pm
List:org.codehaus.groovy.user

I try to create a sample HelloWorld script according to the Mailman example from "Groovy in Action" and some basic things don't seem to work. I apologize in advance if it's only my ignorance.

1. an option is not recognized when using the long arg form

Here I create a CLI with a single required argument and try to use the long arg form:

def cli = new CliBuilder(usage: 'groovy Hello -t') cli.t(argName:'person', longOpt:'to', args:1, required:true, 'person to say hello to') opt = cli.parse(['--to', 'me']) println "t: $opt.t"

It prints out:

t: --

instead of

t: me

2. the option cannot be accessed with argName as described in the book: "If an argName such as myArgName was specified for the x option, then options.x and options.myArgName return the same value"

Here I use the same CLI and try to access the value with opt.person:

def cli = new CliBuilder(usage: 'groovy Hello -t') cli.t(argName:'person', longOpt:'to', args:1, required:true, 'person to say hello to') opt = cli.parse(['-t', 'me']) println "person: $opt.person"

It prints out:

person: false

which means it doesn't know about the 'person' argName.

The same thing happens if the arguments are passed in the cmdline. I've put everything in the script to make it easier for you to run. I am using groovy 1.5.4.

In case these are known limitations of the upstream library, is there any other obvious problem I should guard against? -- View this message in context:
http://www.nabble.com/How-much-of-CliBuilder-does-work--tp16111825p16111825.html Sent from the groovy - user mailing list archive at Nabble.com.

--------------------------------------------------------------------- To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email