Package: org.grails.cli

## [Groovy] Class GrailsCli

- org.grails.cli.GrailsCli

-     @groovy.transform.CompileStatic
      class GrailsCli
      extends java.lang.Object

  Main class for the Grails command line. Handles interactive mode and running Grails commands within the context of a profile

  Authors:
    Lari Hotari
    Graeme Rocher
  Since:
    3.0

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `class` | `GrailsCli.1` |
    `static class` | `GrailsCli.ExecutionContextImpl` |
    `private static class` | `GrailsCli.ProjectContextImpl` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private static java.lang.String` | `ARG_SPLIT_PATTERN` |
    `static java.lang.String` | `DEFAULT_PROFILE_NAME` |
    `private static int` | `KEYPRESS_CTRL_C` |
    `private static int` | `KEYPRESS_ESC` |
    `private static java.lang.String` | `PLUGIN_USAGE_MESSAGE` |
    `private static NavigableMap` | `SETTINGS_MAP` |
    `private static java.lang.String` | `USAGE_MESSAGE` |
    `private SortedAggregateCompleter` | `aggregateCompleter` |
    `private java.lang.Boolean` | `ansiEnabled` |
    `private CodeGenConfig` | `applicationConfig` |
    `private CommandLineParser` | `cliParser` |
    `private static ExecutionContext` | `currentExecutionContext` |
    `private java.lang.Character` | `defaultInputMask` |
    `private boolean` | `integrateGradle` |
    `private static boolean` | `interactiveModeActive` |
    `private boolean` | `keepRunning` |
    `private SystemStreamsRedirector` | `originalStreams` |
    `private Profile` | `profile` |
    `private java.util.List<GrailsRepositoryConfiguration>` | `profileRepositories` |
    `private ProfileRepository` | `profileRepository` |
    `private ProjectContext` | `projectContext` |
    `private static boolean` | `tiggerAppLoad` |

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `static java.lang.String` | `ARG_SPLIT_PATTERN`
    `SortedAggregateCompleter` | `aggregateCompleter`
    `java.lang.Boolean` | `ansiEnabled`
    `CodeGenConfig` | `applicationConfig`
    `CommandLineParser` | `cliParser`
    `java.lang.Character` | `defaultInputMask`
    `boolean` | `integrateGradle`
    `boolean` | `keepRunning`
    `Profile` | `profile`
    `java.util.List<GrailsRepositoryConfiguration>` | `profileRepositories`
    `ProfileRepository` | `profileRepository`
    `ProjectContext` | `projectContext`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GrailsCli ()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static void` | `()`
    `` | `protected java.lang.Boolean` | `bang(ExecutionContext context)`
    `` | `ExecutionContext` | `createExecutionContext(CommandLine commandLine)`
    `` | `protected MavenProfileRepository` | `createMavenProfileRepository()`
    `` | `int` | `execute(java.lang.String[] args)` Execute the given command
    `` | `protected boolean` | `executeCommandWithArgumentValidation(Command cmd, CommandLine mainCommandLine)`
    `` | `protected boolean` | `executeProcess(ExecutionContext context, java.lang.String[] args)`
    `` | `static void` | `exit(int code)`
    `` | `private void` | `exitInteractiveMode()`
    `` | `private int` | `getBaseUsage()`
    `<T>` | `static T` | `getSetting(java.lang.String key, java.lang.Class<T> targetType, T defaultValue)` Obtains a value from USER_HOME/.grails/settings.yml
    `` | `private boolean` | `handleBuiltInCommands(ExecutionContext context)`
    `` | `java.lang.Boolean` | `handleCommand(CommandLine commandLine)`
    `` | `java.lang.Boolean` | `handleCommand(ExecutionContext context)`
    `` | `private java.lang.Boolean` | `handleCommandWithCancellationSupport(GrailsConsole console, java.lang.String commandLine, java.util.concurrent.ExecutorService commandExecutor, jline.internal.NonBlockingInputStream nonBlockingInput)`
    `` | `private void` | `handleInteractiveMode()`
    `` | `protected void` | `initializeApplication(CommandLine mainCommandLine)`
    `` | `private java.lang.Object` | `initializeProfile()`
    `` | `private void` | `interactiveModeLoop(GrailsConsole console, java.util.concurrent.ExecutorService commandExecutor)`
    `` | `static boolean` | `isInteractiveModeActive()`
    `` | `private CodeGenConfig` | `loadApplicationConfig()`
    `` | `static void` | `main(java.lang.String[] args)` Main method for running via the command line
    `` | `protected void` | `outputMissingArgumentsMessage(Command cmd)`
    `` | `protected void` | `populateContextLoader()`
    `` | `protected GrailsConsole` | `setupCompleters()`
    `` | `protected void` | `startInteractiveMode(GrailsConsole console)`
    `` | `static void` | `tiggerAppLoad()`
    `` | `private java.lang.String` | `unescape(java.lang.String str)` Removes '\' escape characters from the given string.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private static final java.lang.String ARG_SPLIT_PATTERN

    - #### public static final java.lang.String DEFAULT_PROFILE_NAME

    - #### private static final int KEYPRESS_CTRL_C

    - #### private static final int KEYPRESS_ESC

    - #### private static final java.lang.String PLUGIN_USAGE_MESSAGE

    - #### private static final NavigableMap SETTINGS_MAP

    - #### private static final java.lang.String USAGE_MESSAGE

    - #### private SortedAggregateCompleter aggregateCompleter

    - #### private java.lang.Boolean ansiEnabled

    - #### private CodeGenConfig applicationConfig

    - #### private CommandLineParser cliParser

    - #### private static ExecutionContext currentExecutionContext

    - #### private java.lang.Character defaultInputMask

    - #### private boolean integrateGradle

    - #### private static boolean interactiveModeActive

    - #### private boolean keepRunning

    - #### private final SystemStreamsRedirector originalStreams

    - #### private Profile profile

    - #### private java.util.List<GrailsRepositoryConfiguration> profileRepositories

    - #### private ProfileRepository profileRepository

    - #### private ProjectContext projectContext

    - #### private static boolean tiggerAppLoad

  - ### Property Detail

    - #### static final java.lang.String ARG_SPLIT_PATTERN

    - #### SortedAggregateCompleter aggregateCompleter

    - #### java.lang.Boolean ansiEnabled

    - #### CodeGenConfig applicationConfig

    - #### CommandLineParser cliParser

    - #### java.lang.Character defaultInputMask

    - #### boolean integrateGradle

    - #### boolean keepRunning

    - #### Profile profile

    - #### java.util.List<GrailsRepositoryConfiguration> profileRepositories

    - #### ProfileRepository profileRepository

    - #### ProjectContext projectContext

  - ### Constructor Detail

    - #### GrailsCli()

  - ### Method Detail

    - #### static void ()

    - #### protected java.lang.Boolean bang(ExecutionContext context)

    - #### ExecutionContext createExecutionContext(CommandLine commandLine)

    - #### protected MavenProfileRepository createMavenProfileRepository()

    - #### int execute(java.lang.String[] args)

      Execute the given command

      Parameters:
        `args` - The arguments
      Returns:
        The exit status code

    - #### protected boolean executeCommandWithArgumentValidation(Command cmd, CommandLine mainCommandLine)

    - #### protected boolean executeProcess(ExecutionContext context, java.lang.String[] args)

    - #### static void exit(int code)

    - #### private void exitInteractiveMode()

    - #### private int getBaseUsage()

    - #### <T> static T getSetting(java.lang.String key, java.lang.Class<T> targetType, T defaultValue)

      Obtains a value from USER_HOME/.grails/settings.yml

      Parameters:
        `key` - the property name to resolve
        `targetType` - the expected type of the property value
        `defaultValue` - The default value

    - #### private boolean handleBuiltInCommands(ExecutionContext context)

    - #### java.lang.Boolean handleCommand(CommandLine commandLine)

    - #### java.lang.Boolean handleCommand(ExecutionContext context)

    - #### private java.lang.Boolean handleCommandWithCancellationSupport(GrailsConsole console, java.lang.String commandLine, java.util.concurrent.ExecutorService commandExecutor, jline.internal.NonBlockingInputStream nonBlockingInput)

    - #### private void handleInteractiveMode()

    - #### protected void initializeApplication(CommandLine mainCommandLine)

    - #### private java.lang.Object initializeProfile()

    - #### private void interactiveModeLoop(GrailsConsole console, java.util.concurrent.ExecutorService commandExecutor)

    - #### static boolean isInteractiveModeActive()

    - #### private CodeGenConfig loadApplicationConfig()

    - #### static void main(java.lang.String[] args)

      Main method for running via the command line

      Parameters:
        `args` - The arguments

    - #### protected void outputMissingArgumentsMessage(Command cmd)

    - #### protected void populateContextLoader()

    - #### protected GrailsConsole setupCompleters()

    - #### protected void startInteractiveMode(GrailsConsole console)

    - #### static void tiggerAppLoad()

    - #### private java.lang.String unescape(java.lang.String str)

      Removes '\' escape characters from the given string.