I'm new to Groovy, and I'm trying to figure out what the args attribute on CliBuilder means. I'm not sure if this means the maximum number of parameters that a parameter can take.
I have something like
import java.text.*
def test(args) {
def cli = new CliBuilder(usage: 'test.groovy brand instance')
cli.with {
h longOpt: 'help', 'Show usage information'
}
cli.b(argName:'brand', args: 1, required: true, 'brand name')
cli.p(argName:'ports', args: 2, required: true, 'ports')
def options = cli.parse(args)
if (!options) {
return
}
if (options.h) {
cli.usage()
return
}
println options.b
println options.p
}
test(args)
When I invoke the script, I use groovy test.groovy -b toto -p 10 11
But I get:
toto
10
Should I get 10 11 for the -p option? If not, what does args mean?
thank
source
share