Package: org.grails.cli.profile.commands.script

## [Groovy] Class GroovyScriptCommand

- org.grails.cli.profile.commands.script.GroovyScriptCommand

- All Implemented Interfaces and Traits:
    CommandEvents, ConsoleLogger, ModelBuilder, ProfileCommand, ProfileRepositoryAware, grails.dev.commands.io.FileSystemInteraction, ServerInteraction, TemplateRenderer

      @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

  Authors:
    Graeme Rocher
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private groovy.util.AntBuilder` | `ant` | Access to Ant via AntBuilder
    `private ConsoleLogger` | `consoleLogger` |
    `private CommandDescription` | `description` |
    `private ExecutionContext` | `executionContext` |
    `private grails.dev.commands.io.FileSystemInteraction` | `fileSystemInteraction` |
    `private GradleInvoker` | `gradle` | Allows invoking of Gradle commands
    `private java.lang.String` | `grailsVersion` | The version of Grails being used
    `private java.lang.String` | `name` |
    `private Profile` | `profile` |
    `private ProfileRepository` | `profileRepository` |
    `private SpringInvoker` | `spring` | Allows invoking of Spring Boot's CLI
    `private TemplateRenderer` | `templateRenderer` |
    `private java.lang.String` | `userHome` | The location of the user.home directory

  - ### Properties Summary

    Properties
    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 Summary

    Constructors
    Constructor and description
    `GroovyScriptCommand ()`

  - ### Methods Summary

    Methods
    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()` Returns: The arguments as a list of strings
    `` | `java.util.Map<java.lang.String, java.lang.Object>` | `getArgsMap()` Returns: The undeclared command line arguments
    `` | `ExecutionContext` | `getExecutionContext()`
    `` | `GrailsConsole` | `getGrailsConsole()` Returns: The GrailsConsole instance
    `` | `java.lang.String` | `getGrailsEnv()` Returns: The name of the current Grails environment
    `` | `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)`

  - ### Inherited Methods Summary

    Inherited Methods
    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#getProperty(java.lang.String), groovy.lang.Script#setProperty(java.lang.String, java.lang.Object), 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), groovy.lang.Script#wait(long, int), 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()`

- - ### Field Detail

    - #### private groovy.util.AntBuilder ant

      Access to Ant via AntBuilder

    - #### @groovy.lang.Delegate private ConsoleLogger consoleLogger

    - #### private CommandDescription description

    - #### @groovy.lang.Delegate private ExecutionContext executionContext

    - #### @groovy.lang.Delegate private grails.dev.commands.io.FileSystemInteraction fileSystemInteraction

    - #### private GradleInvoker gradle

      Allows invoking of Gradle commands

    - #### private java.lang.String grailsVersion

      The version of Grails being used

    - #### private java.lang.String name

    - #### private Profile profile

    - #### private ProfileRepository profileRepository

    - #### private SpringInvoker spring

      Allows invoking of Spring Boot's CLI

    - #### @groovy.lang.Delegate private TemplateRenderer templateRenderer

    - #### private java.lang.String userHome

      The location of the user.home directory

  - ### Property Detail

    - #### groovy.util.AntBuilder ant

      Access to Ant via AntBuilder

    - #### @groovy.lang.Delegate ConsoleLogger consoleLogger

    - #### CommandDescription description

    - #### @groovy.lang.Delegate ExecutionContext executionContext

    - #### ExecutionContext executionContext

    - #### @groovy.lang.Delegate 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

    - #### @groovy.lang.Delegate TemplateRenderer templateRenderer

    - #### java.lang.String userHome

      The location of the user.home directory

  - ### Constructor Detail

    - #### GroovyScriptCommand()

  - ### Method Detail

    - #### void description(java.lang.String desc, java.lang.String usage)

      Provides a description for the command

      Parameters:
        `desc` - The description
        `usage` - The usage information

    - #### void description(java.lang.String desc, groovy.lang.Closure detail)

      Provides a description for the command

      Parameters:
        `desc` - The description
        `usage` - The usage information

    - #### java.lang.Object flag(java.lang.String name)

      Obtains details of the given flag if it has been set by the user

      Parameters:
        `name` - The name of the flag
      Returns:
        The flag information, or null if it isn't set by the user

    - #### java.util.List<java.lang.String> getArgs()

      Returns:
        The arguments as a list of strings

    - #### java.util.Map<java.lang.String, java.lang.Object> getArgsMap()

      Returns:
        The undeclared command line arguments

    - #### ExecutionContext getExecutionContext()

    - #### GrailsConsole getGrailsConsole()

      Returns:
        The GrailsConsole instance

    - #### java.lang.String getGrailsEnv()

      Returns:
        The name of the current Grails environment

    - #### @java.lang.Override boolean handle(ExecutionContext executionContext)

      Implementation of the handle method that runs the script

      Parameters:
        `executionContext` - The ExecutionContext
      Returns:
        True if the script succeeds, false otherwise

    - #### java.lang.Object methodMissing(java.lang.String name, java.lang.Object args)

      Method missing handler used to invoke other commands from a command script

      Parameters:
        `name` - The name of the command as a method name (for example 'run-app' would be runApp())
        `args` - The arguments to the command

    - #### void setExecutionContext(ExecutionContext executionContext)