Skip to content

Instantly share code, notes, and snippets.

@miceno
Created December 12, 2010 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miceno/738266 to your computer and use it in GitHub Desktop.
Save miceno/738266 to your computer and use it in GitHub Desktop.
Read commandline with DSL CliBuilder
// 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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment