Main (Groovy 4.0.15)

Package: org.apache.groovy.groovysh

## [Groovy] Class Main

- org.apache.groovy.groovysh.Main

-     @AutoFinal
      @CompileStatic
      class Main
      extends Object

  A Main instance has a Groovysh member representing the shell, and a startGroovysh() method to run an interactive shell. Subclasses should preferably extend createIO() or configure the shell via getShell prior to invoking startGroovysh. Clients may use configureAndStartGroovysh to provide the same CLI params but a different Groovysh implementation (implementing getIO() and run()). The class also has static utility methods to manipulate the static ansi state using the jAnsi library. Main CLI entry-point for `groovysh`.

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `Groovysh` | `groovysh`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `Main(IO io)` Parameters: `io:` - may just be new IO(), which is the default
    `Main(IO io, CompilerConfiguration configuration)` Parameters: `io:` - may just be new IO(), which is the default

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static void` | `installAnsi()`
    `` | `static void` | `main(String[] args)` create a Main instance, configures it according to CLI arguments, and starts the shell.
    `` | `static void` | `setSystemProperty(String nameValue)`
    `` | `static void` | `setTerminalType(String type, boolean suppressColor)` Parameters: `type:` - one of 'auto', 'unix', ('win', 'windows'), ('false', 'off', 'none')
    `` | `protected void` | `startGroovysh(String evalString, List<String> filenames)` Parameters: `evalString` - commands that will be executed at startup after loading files given with filenames param

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Property Detail

    - #### final Groovysh groovysh

  - ### Constructor Detail

    - #### Main(IO io)

      Parameters:
        `io:` - may just be new IO(), which is the default

    - #### Main(IO io, CompilerConfiguration configuration)

      Parameters:
        `io:` - may just be new IO(), which is the default

  - ### Method Detail

    - #### static void installAnsi()

    - #### @CompileDynamic
      static void main(String[] args)

      create a Main instance, configures it according to CLI arguments, and starts the shell.

      Parameters:
        `main` - must have a Groovysh member that has an IO member.

    - #### @Deprecated
      static void setSystemProperty(String nameValue)

    - #### @AutoFinal(enabled: false)
      static void setTerminalType(String type, boolean suppressColor)

      Parameters:
        `type:` - one of 'auto', 'unix', ('win', 'windows'), ('false', 'off', 'none')
        `suppressColor` - only has effect when ansi is enabled

    - #### protected void startGroovysh(String evalString, List<String> filenames)

      Parameters:
        `evalString` - commands that will be executed at startup after loading files given with filenames param
        `filenames` - files that will be loaded at startup