Guest User

Untitled

a guest
Jun 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. // g100pon #77 CliBuilder
  2.  
  3. def cli = new CliBuilder(usage:'groovy CliBuilderSample.groovy -f filename [-d]')
  4.  
  5. cli.h(longOpt:'help', 'ヘルプ')
  6. cli.f(longOpt:'file', required:true, args:1, '処理対象ファイル名')
  7. cli.d(longOpt:'debug', 'デバッグモード')
  8.  
  9. def options = cli.parse(args)
  10.  
  11. if (!options) return
  12.  
  13. if (options.h) {
  14. cli.usage()
  15. return
  16. }
  17.  
  18. if (options.f) println "オプション-fが指定されました(引数=${options.f})"
  19.  
  20. if (options.d) println "オプション-dが指定されました"
Add Comment
Please, Sign In to add comment