HOWTO: Handling Command line Arguments in a Groovy Script

println "Started Groovy Script"
 println "All args Received : "
 println args
className = getClass().simpleName
 def cli = new CliBuilder(usage: "groovy ${className}.groovy -h HOSTNAME -u USERNAME -p PASSWORD -pt PROCESSTYPEURI -a INPUTANALYTELIMSID")
 cli.u(argName:'username', longOpt:'username', required:true, args:1, 'LIMS username (Required)')
 cli.p(argName:'password', longOpt:'password', required:true, args:1, 'LIMS password (Required)')'processTypeURI', longOpt:'processTypeURI', required:true, args:1, 'The Uri of the process used in process (Required)')
def opt = cli.parse(args)
 if (!opt) {
 println "Aborted Groovy Script"
 hostname = opt.h
 username = opt.u
 password = opt.p
 processTypeURI =
 inputAnalyeLIMSID = opt.a

See :