Skip to content

Instantly share code, notes, and snippets.

@nobusue
Created October 10, 2010 08:55
Show Gist options
  • Save nobusue/619094 to your computer and use it in GitHub Desktop.
Save nobusue/619094 to your computer and use it in GitHub Desktop.
// g100pon #77 CliBuilder
def cli = new CliBuilder(usage:'groovy CliBuilderSample.groovy -f filename [-d]')
cli.h(longOpt:'help', 'ヘルプ')
cli.f(longOpt:'file', required:true, args:1, '処理対象ファイル名')
cli.d(longOpt:'debug', 'デバッグモード')
def options = cli.parse(args)
if (!options) return
if (options.h) {
cli.usage()
return
}
if (options.f) println "オプション-fが指定されました(引数=${options.f})"
if (options.d) println "オプション-dが指定されました"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment