org.springframework.shell.core

## Interface Shell

- All Superinterfaces:
    ShellPromptAccessor, ShellStatusProvider
  All Known Implementing Classes:
    AbstractShell, JLineShell, JLineShellComponent

      public interface Shell
      extends ShellStatusProvider, ShellPromptAccessor

  Specifies the contract for an interactive shell.

  Any interactive shell class which implements these methods can be launched by the roo-bootstrap mechanism.

  It is envisaged implementations will be provided for JLine initially, with possible implementations for Eclipse in the future.

  Since:
    1.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `WINDOW_TITLE_SLOT` The slot name to use with `flash(Level, String, String)` if a caller wishes to modify the window title.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `CommandResult` | `executeCommand(String line)` Runs the specified command.
    `void` | `flash(Level level, String message, String slot)` Displays a progress notification to the user.
    `ExitShellRequest` | `getExitShellRequest()`
    `File` | `getHome()` Returns the home directory of the current running shell instance
    `boolean` | `isDevelopmentMode()`
    `void` | `promptLoop()` Presents a console prompt and allows the user to interact with the shell.
    `void` | `setDevelopmentMode(boolean developmentMode)` Indicates the shell should switch into a lower-level development mode.
    `void` | `setPromptPath(String path)` Changes the "path" displayed in the shell prompt.
    `void` | `setPromptPath(String path, boolean overrideStyle)`

    - ### Methods inherited from interface org.springframework.shell.event.ShellStatusProvider

      `addShellStatusListener, getShellStatus, removeShellStatusListener`

    - ### Methods inherited from interface org.springframework.shell.core.ShellPromptAccessor

      `getShellPrompt`

- - ### Field Detail

    - #### WINDOW_TITLE_SLOT

          static final String WINDOW_TITLE_SLOT

      The slot name to use with `flash(Level, String, String)` if a caller wishes to modify the window title. This may not be supported by all operating system shells. It is provided on a best-effort basis only.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### promptLoop

          void promptLoop()

      Presents a console prompt and allows the user to interact with the shell. The shell should not return to the caller until the user has finished their session (by way of a "quit" or similar command).

    - #### getExitShellRequest

          ExitShellRequest getExitShellRequest()

      Returns:
        null if no exit was requested, otherwise the last exit code indicated to the shell to use

    - #### executeCommand

          CommandResult executeCommand(String line)

      Runs the specified command. Control will return to the caller after the command is run.
      Parameters:
        `line` - to execute (required)
      Returns:
        true if the command was successful, false if there was an exception

    - #### setDevelopmentMode

          void setDevelopmentMode(boolean developmentMode)

      Indicates the shell should switch into a lower-level development mode. The exact meaning varies by shell implementation.
      Parameters:
        `developmentMode` - true if development mode should be enabled, false otherwise

    - #### flash

          void flash(Level level,
                   String message,
                   String slot)

      Displays a progress notification to the user. This notification will ideally be displayed in a consistent screen location by the shell implementation.

      An implementation may allow multiple messages to be displayed concurrently. So an implementation can determine when a flash message replaces a previous flash message, callers should allocate a unique "slot" name for their messages. It is suggested the class name of the caller be used. This way a slot will be updated without conflicting with flash message sequences from other slots.

      Passing an empty string in as the "message" indicates the slot should be cleared.

      An implementation need not necessarily use the level or slot concepts. They are expected to be used in most cases, though.

      Parameters:
        `level` - the importance of the message (cannot be null)
        `message` - to display (cannot be null, but may be empty)
        `slot` - the identification slot for the message (cannot be null or empty)

    - #### isDevelopmentMode

          boolean isDevelopmentMode()

    - #### setPromptPath

          void setPromptPath(String path)

      Changes the "path" displayed in the shell prompt. An implementation will ensure this path is included on the screen, taking care to merge it with the product name and handle any special formatting requirements (such as ANSI, if supported by the implementation).
      Parameters:
        `path` - to set (can be null or empty; must NOT be formatted in any special way eg ANSI codes)

    - #### setPromptPath

          void setPromptPath(String path,
                           boolean overrideStyle)

    - #### getHome

          File getHome()

      Returns the home directory of the current running shell instance
      Returns:
        the home directory of the current shell instance