First proper draft of DSL for Groovy Commands
Users can declare or Command, OptionHandler classes in an init script
or they can use a DSL, e.g.
command("foo") { args -> println "Do stuff with ${args} array" }
or
command("foo") {
options { option "bar", "Help text for bar option" ithOptionArg() ofType Integer }
run { options -> println "Do stuff with ${options.valueOf('bar')}" }
}
This commit is contained in:
@@ -31,7 +31,6 @@ class TestCommand extends OptionHandler {
|
||||
void run(OptionSet options) {
|
||||
// Demonstrate use of Grape.grab to load dependencies before running
|
||||
println "Clean: " + Git.open(".." as File).status().call().isClean()
|
||||
org.springframework.boot.cli.command.ScriptCommandTests.executed = true
|
||||
println "Hello ${options.nonOptionArguments()}: ${options.has('foo')}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user