Overview | Package | Class
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.tools.shell
Class Groovysh

An interactive shell for evaluating Groovy code from the command-line (aka. groovysh).

version:
  $Id: Groovysh.groovy 12139 2008-04-27 11:55:07Z paulk $

author:
  Jason Dillon

Field Summary
`String` | `EVAL_SCRIPT_FILENAME`
`String` | `NEWLINE`
`BufferManager` | `buffers`
`Closure` | `defaultErrorHook`
`Closure` | `defaultResultHook`
`Closure` | `errorHook`
`History` | `history`
`List` | `imports`
`GroovyShell` | `interp`
`MessageSource` | `messages`
`AnsiRenderer` | `prompt`
`Closure` | `resultHook`
`InteractiveShellRunner` | `runner`

Constructor Summary
`Groovysh(ClassLoader classLoader, Binding binding, IO io)`
`Groovysh(Binding binding, IO io)`
`Groovysh(IO io)`
`Groovysh()`

Method Summary
`void` | `displayBuffer(List buffer)` Display the given buffer.
`void` | `displayError(Throwable cause)`
`Object` | `evaluate(List buffer)` Evaluate the given buffer.
`Object` | `execute(String line)` Execute a single line, where the line may be a command or Groovy code (complete or incomplete).
`Object` | `executeCommand(String line)`
`String` | `formatLineNumber(int num)` Format the given number suitable for rendering as a line number column.
`Object` | `getLastResult()`
`File` | `getUserStateDirectory()`
`void` | `loadUserScript(String filename)`
`void` | `maybeRecordError(Throwable cause)`
`void` | `maybeRecordInput(String line)`
`void` | `maybeRecordResult(Object result)`
`ParseStatus` | `parse(List buffer, int tolerance)` Attempt to parse the given buffer.
`String` | `renderPrompt()`
`int` | `run(def args)`
`int` | `run(String commandLine)`
`void` | `setLastResult(Object result)`

Constructor Detail

### Groovysh

    public Groovysh(ClassLoader classLoader, Binding binding, IO io)

### Groovysh

    public Groovysh(Binding binding, IO io)

### Groovysh

    public Groovysh(IO io)

### Groovysh

    public Groovysh()

Method Detail

### displayBuffer

    void displayBuffer(List buffer)

  Display the given buffer.

### displayError

    void displayError(Throwable cause)

### evaluate

    Object evaluate(List buffer)

  Evaluate the given buffer. The buffer is assumed to be complete.

### execute

    Object execute(String line)

  Execute a single line, where the line may be a command or Groovy code (complete or incomplete).

### executeCommand

    Object executeCommand(String line)

### formatLineNumber

    String formatLineNumber(int num)

  Format the given number suitable for rendering as a line number column.

### getLastResult

    Object getLastResult()

### getUserStateDirectory

    File getUserStateDirectory()

### loadUserScript

    void loadUserScript(String filename)

### maybeRecordError

    void maybeRecordError(Throwable cause)

### maybeRecordInput

    void maybeRecordInput(String line)

### maybeRecordResult

    void maybeRecordResult(Object result)

### parse

    ParseStatus parse(List buffer, int tolerance)

  Attempt to parse the given buffer.

### renderPrompt

    String renderPrompt()

### run

    int run(def args)

### run

    int run(String commandLine)

### setLastResult

    void setLastResult(Object result)