Created
October 10, 2010 08:55
-
-
Save nobusue/619094 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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