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