public interface Shell extends ShellStatusProvider, ShellPromptAccessor
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.
| 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. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListerner(CommandListener listener)
To add new CommandListener on Shell object, use addListener method.
|
boolean |
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 |
removeListener(CommandListener listener)
To remove CommandListener on Shell object, use removeListener method
|
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) |
void |
setTailor(Tailor tailor)
To support API compatibility with STS shell, tailor implementation should
be injected explicitly when activated.
|
addShellStatusListener, getShellStatus, removeShellStatusListenergetShellPromptstatic final String WINDOW_TITLE_SLOT
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.boolean executeCommand(String line)
line - to execute (required)void flash(Level level, String message, String slot)
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.
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)ExitShellRequest getExitShellRequest()
File getHome()
boolean isDevelopmentMode()
void promptLoop()
void setDevelopmentMode(boolean developmentMode)
developmentMode - true if development mode should be enabled, false
otherwisevoid setPromptPath(String path)
path - to set (can be null or empty; must NOT be formatted in any
special way eg ANSI codes)void setPromptPath(String path, boolean overrideStyle)
void setTailor(Tailor tailor)
tailor - the tailor implementationvoid addListerner(CommandListener listener)
listener - void removeListener(CommandListener listener)
listener - Copyright © 2009–2017 Pivotal Software, Inc.. All rights reserved.