Return to Snippet

Revision: 37586
at December 13, 2010 06:43 by miceno


Updated Code
// An example of how to configure the CliBuilder to read command line arguments in Groovy.

def cli = new CliBuilder( usage: 'groovy launcher' )

// Option help
cli.h(longOpt: 'help', 'usage information')

// Option script
cli.s(argName:'script', longOpt:'script', required: true,
      args: 1, 'Script filename')

def opt = cli.parse(args)
if (!opt) return
if (opt.h) {
   cli.usage()
   return null
}

Revision: 37585
at December 13, 2010 06:39 by miceno


Initial Code
def cli = new CliBuilder( usage: 'groovy launcher' )

cli.h(longOpt: 'help', 'usage information')
cli.s(argName:'script', longOpt:'script', required: true,
      args: 1, 'Script filename')

def opt = cli.parse(args)
if (!opt) return
if (opt.h) {
   cli.usage()
   return null
}

Initial URL

                                

Initial Description
An example of how to configure the CliBuilder to read command line arguments in Groovy.

Initial Title
Read commandline with DSL CliBuilder

Initial Tags
groovy

Initial Language
Groovy