@groovy.transform.CompileStatic abstract class GroovyScriptCommand extends groovy.lang.Script implements CommandEvents, ConsoleLogger, ModelBuilder, ProfileCommand, ProfileRepositoryAware, grails.dev.commands.io.FileSystemInteraction, ServerInteraction, TemplateRenderer
A base class for Groovy scripts that implement commands
Type | Name and description |
---|---|
groovy.util.AntBuilder |
ant Access to Ant via AntBuilder |
ConsoleLogger |
consoleLogger |
CommandDescription |
description |
ExecutionContext |
executionContext |
ExecutionContext |
executionContext |
grails.dev.commands.io.FileSystemInteraction |
fileSystemInteraction |
GradleInvoker |
gradle Allows invoking of Gradle commands |
java.lang.String |
grailsVersion The version of Grails being used |
java.lang.String |
name |
Profile |
profile |
ProfileRepository |
profileRepository |
SpringInvoker |
spring Allows invoking of Spring Boot's CLI |
TemplateRenderer |
templateRenderer |
java.lang.String |
userHome The location of the user.home directory |
Constructor and description |
---|
GroovyScriptCommand
() |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
description(java.lang.String desc, java.lang.String usage) Provides a description for the command |
|
void |
description(java.lang.String desc, groovy.lang.Closure detail) Provides a description for the command |
|
java.lang.Object |
flag(java.lang.String name) Obtains details of the given flag if it has been set by the user |
|
java.util.List<java.lang.String> |
getArgs()
|
|
java.util.Map<java.lang.String, java.lang.Object> |
getArgsMap()
|
|
ExecutionContext |
getExecutionContext() |
|
GrailsConsole |
getGrailsConsole()
|
|
java.lang.String |
getGrailsEnv()
|
|
boolean |
handle(ExecutionContext executionContext) Implementation of the handle method that runs the script |
|
java.lang.Object |
methodMissing(java.lang.String name, java.lang.Object args) Method missing handler used to invoke other commands from a command script |
|
void |
setExecutionContext(ExecutionContext executionContext) |
Methods inherited from class | Name |
---|---|
class groovy.lang.Script |
groovy.lang.Script#evaluate(java.io.File), groovy.lang.Script#evaluate(java.lang.String), groovy.lang.Script#getBinding(), groovy.lang.Script#setBinding(groovy.lang.Binding), groovy.lang.Script#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.Script#println(java.lang.Object), groovy.lang.Script#println(), groovy.lang.Script#run(java.io.File, [Ljava.lang.String;), groovy.lang.Script#run(), groovy.lang.Script#setProperty(java.lang.String, java.lang.Object), groovy.lang.Script#getProperty(java.lang.String), groovy.lang.Script#print(java.lang.Object), groovy.lang.Script#printf(java.lang.String, java.lang.Object), groovy.lang.Script#printf(java.lang.String, [Ljava.lang.Object;), groovy.lang.Script#getMetaClass(), groovy.lang.Script#setMetaClass(groovy.lang.MetaClass), groovy.lang.Script#wait(long, int), groovy.lang.Script#wait(long), groovy.lang.Script#wait(), groovy.lang.Script#equals(java.lang.Object), groovy.lang.Script#toString(), groovy.lang.Script#hashCode(), groovy.lang.Script#getClass(), groovy.lang.Script#notify(), groovy.lang.Script#notifyAll() |
Access to Ant via AntBuilder
Allows invoking of Gradle commands
The version of Grails being used
Allows invoking of Spring Boot's CLI
The location of the user.home directory
Provides a description for the command
desc
- The descriptionusage
- The usage informationProvides a description for the command
desc
- The descriptionusage
- The usage informationObtains details of the given flag if it has been set by the user
name
- The name of the flag
Implementation of the handle method that runs the script
executionContext
- The ExecutionContextMethod missing handler used to invoke other commands from a command script
name
- The name of the command as a method name (for example 'run-app' would be runApp())args
- The arguments to the commandGroovy Documentation