public interface Shell extends ShellPrintWriter, ShellPrompt, ShellHistory
| Modifier and Type | Method and Description |
|---|---|
void |
bufferingMode()
Place the shell output into buffering mode.
|
void |
clear()
Clear the console.
|
void |
clearLine()
Clear the current line of any text.
|
void |
cursorLeft(int x)
Move the cursor x the specified number of positions.
|
void |
directWriteMode()
Place the shell output in direct-write mode.
|
void |
execute(File file)
Execute a shell script from the specified file.
|
void |
execute(File file,
String... args)
Execute a shell script from the specified file, passing the given arguments as input.
|
void |
execute(String command)
Execute a shell command.
|
int |
getAbsoluteHeight()
Return the absolute height of the console.
|
BufferManager |
getBufferManager()
Get buffer manager based on typed
|
DirectoryResource |
getConfigDir()
Return the file-system directory currently in use as the configuration directory.
|
DirectoryResource |
getCurrentDirectory()
Return the current working directory resource of the shell.
|
Project |
getCurrentProject()
Return the
Project on which this shell instance is currently operating. |
Resource<?> |
getCurrentResource()
Return the current working
Resource of the shell. |
Class<? extends Resource<?>> |
getCurrentResourceScope()
Return the type of the
Resource on which the Shell is currently operating. |
ForgeEnvironment |
getEnvironment()
Get the current Forge environment.
|
int |
getHeight()
Return the current height, in characters, of the current shell console.
|
String |
getPrompt()
Return the current shell prompt;
|
int |
getWidth()
Return the current width, in characters, of the current shell console.
|
boolean |
isAcceptDefaults()
Return true if this
Shell is currently set to accept prompt defaults automatically. |
boolean |
isAnsiSupported()
Returns whether or not this shell supports ANSI escape codes.
|
boolean |
isExceptionHandlingEnabled()
Return true if this shell is currently set to handle exceptions.
|
boolean |
isExecuting()
Return true if the
Shell is currently executing a plugin; otherwise, return false. |
boolean |
isHistoryEnabled()
Return true if this shell is currently keeping a record of command history.
|
boolean |
isPretend()
Return true if this shell is currently running in pretend mode.
|
boolean |
isVerbose()
Return true if this shell is currently running in verbose mode.
|
void |
printlnVerbose(ShellColor color,
String output)
Write color output to the console, only if
isVerbose() == true. |
void |
printlnVerbose(String output)
Write output to the console, only if
isVerbose() == true. |
String |
readLine()
Ask the current
InputStream for data. |
String |
readLine(Character mask)
Ask the current
InputStream for input, masking keystrokes in the console with the given mask. |
void |
registerBufferManager(BufferManager manager)
Register the buffer manager for the shell system
|
void |
registerKeyListener(KeyListener keyListener)
Register a
KeyListener object that will defined behavior when a given key is received from the
Shell |
int |
scan()
Wait for input.
|
void |
setAcceptDefaults(boolean accept)
Set this
Shell to accept prompt defaults automatically. |
void |
setAnsiSupported(boolean value)
Controls the shell's usage of ANSI escape code support.
|
void |
setCurrentResource(Resource<?> resource)
Set the
Resource on which the shell should operate. |
void |
setDefaultPrompt()
Reset the shell prompt to default.
|
void |
setExceptionHandlingEnabled(boolean enabled)
Toggle exception handling.
|
void |
setHistoryEnabled(boolean history)
Toggle whether or not this shell should keep a record of command history.
|
void |
setInputStream(InputStream inputStream)
Set the stream from which the shell should read input.
|
void |
setOutputStream(OutputStream stream)
Set the stream to which the shell should print output.
|
void |
setPrompt(String string)
Set the current shell prompt, followed by '> '.
|
void |
setVerbose(boolean verbose)
Toggle verbose mode.
|
flush, print, print, println, println, println, renderColor, write, write, write, writeprompt, prompt, prompt, prompt, prompt, promptAndSwallowCR, promptBoolean, promptBoolean, promptChoice, promptChoice, promptChoice, promptChoiceTyped, promptChoiceTyped, promptCommon, promptCommon, promptCompleter, promptEnum, promptEnum, promptFile, promptFile, promptMultiSelect, promptMultiSelect, promptMultiSelect, promptMultiSelectWithWildcard, promptMultiSelectWithWildcard, promptMultiSelectWithWildcard, promptRegex, promptRegex, promptSecret, promptSecretsetHistory, setHistoryOutputStream, writeToHistoryDirectoryResource getCurrentDirectory()
getCurrentResource() and move up
the hierarchy until a DirectoryResource is found. (This value may change through execution of plug-ins or
other operations.)Resource<?> getCurrentResource()
Resource of the shell. (This value may change through execution of plug-ins or
other operations.)
TODO implement ResourceBag for multiple resourcesClass<? extends Resource<?>> getCurrentResourceScope()
Resource on which the Shell is currently operating.RequiresResource}void setCurrentResource(Resource<?> resource)
Resource on which the shell should operate.
Note: This may change the current getCurrentDirectory()
DirectoryResource getConfigDir()
Project getCurrentProject()
Project on which this shell instance is currently operating.boolean isExceptionHandlingEnabled()
void setExceptionHandlingEnabled(boolean enabled)
#isExceptionHandlingEnabled()}boolean isAcceptDefaults()
Shell is currently set to accept prompt defaults automatically.void setAcceptDefaults(boolean accept)
Shell to accept prompt defaults automatically.boolean isPretend()
boolean isVerbose()
void setVerbose(boolean verbose)
boolean isHistoryEnabled()
void setHistoryEnabled(boolean history)
void printlnVerbose(String output)
isVerbose() == true.void printlnVerbose(ShellColor color, String output)
isVerbose() == true.void clear()
void execute(String command) throws Exception
Throwable - if an exception is encountered an isExceptionHandlingEnabled() is not enabled.Exceptionvoid execute(File file) throws IOException, Exception
IOExceptionException#execute(String)}void execute(File file, String... args) throws IOException, Exception
IOExceptionException#execute(File)}boolean isExecuting()
Shell is currently executing a plugin; otherwise, return false.int scan()
void clearLine()
void cursorLeft(int x)
void setDefaultPrompt()
void setPrompt(String string)
String getPrompt()
void setInputStream(InputStream inputStream) throws IOException
IOExceptionvoid setOutputStream(OutputStream stream) throws IOException
IOExceptionint getHeight()
int getAbsoluteHeight()
int getWidth()
String readLine() throws IOException
InputStream for data.IOException - on errorString readLine(Character mask) throws IOException
InputStream for input, masking keystrokes in the console with the given mask.mask - The character to use for masking inputIOException - on errorvoid setAnsiSupported(boolean value)
boolean isAnsiSupported()
void registerBufferManager(BufferManager manager)
manager - BufferManager getBufferManager()
void registerKeyListener(KeyListener keyListener)
KeyListener object that will defined behavior when a given key is received from the
Shellvoid bufferingMode()
directWriteMode() or by calling ShellPrintWriter.flush()void directWriteMode()
ForgeEnvironment getEnvironment()
Copyright © 2013 JBoss by Red Hat. All Rights Reserved.