I am just starting out with Groovy. I couldn't find any examples anywhere of how to handle arguments to a Groovy script and so I hacked this method myself. There must be a better way of doing this? If so, I am looking for this better way, since I am probably overlooking the obvious.
import groovy.lang.Binding;
Binding binding = new Binding();
int x = 1
for (a in this.args) {
println("arg$x: " + a)
binding.setProperty("arg$x", a);
x=x+1
}
println binding.getProperty("arg1")
println binding.getProperty("arg2")
println binding.getProperty("arg3")
Sorry about asking the question. I just figured it out:
println args[0]
println args[1]
println args[2]