public interface ConsoleEngine extends CommandRegistry
| Modifier and Type | Interface and Description |
|---|---|
static class |
ConsoleEngine.ExecutionResult |
static class |
ConsoleEngine.WidgetCreator |
CommandRegistry.CommandSession| Modifier and Type | Method and Description |
|---|---|
<T> T |
consoleOption(String option,
T defval)
Read console option value
|
default Object |
execute(File script)
Executes either JLine or ScriptEngine script.
|
Object |
execute(File script,
String rawLine,
String[] args)
Executes either JLine or ScriptEngine script.
|
Object |
execute(String name,
String rawLine,
String[] args)
Executes command line that does not contain known command by the system registry.
|
boolean |
executeWidget(Object function)
Execute widget function
|
String |
expandCommandLine(String line)
Substitutes command line with system registry invoke method call.
|
Object[] |
expandParameters(String[] args)
Substituting args references with their values.
|
String |
expandToList(List<String> params)
Expands parameter list to string
|
String |
getAlias(String name)
Returns alias 'name' value
|
List<String> |
getNamedPipes()
Returns named pipe names
|
Map<String,List<String>> |
getPipes()
Returns defined pipes
|
Object |
getVariable(String name)
Get variable value
|
boolean |
hasAlias(String name)
Returns true if alias 'name' exists
|
boolean |
hasVariable(String name)
Test if variable with name exists
|
boolean |
isExecuting() |
void |
persist(Path file,
Object object)
Persist object to file
|
static String |
plainCommand(String command)
Removes the command name first character if it is colon
|
ConsoleEngine.ExecutionResult |
postProcess(Object result)
Post processes execution result.
|
ConsoleEngine.ExecutionResult |
postProcess(String line,
Object result,
String output)
Post processes execution result.
|
void |
println(Map<String,Object> options,
Object object)
Print object.
|
void |
println(Object object)
Print object.
|
void |
purge()
Delete temporary console variables
|
void |
putVariable(String name,
Object value)
Create console variable
|
List<Completer> |
scriptCompleters()
Returns script and variable completers
|
Map<String,Boolean> |
scripts()
Returns all scripts found from PATH
|
void |
setLineReader(LineReader reader)
Sets lineReader
|
void |
setScriptExtension(String extension)
Sets file name extension used by console scripts
|
void |
setSystemRegistry(SystemRegistry systemRegistry)
Sets systemRegistry
|
Object |
slurp(Path file)
Read object from file
|
void |
trace(Object object) |
aggregateCompleters, commandAliases, commandDescription, commandInfo, commandNames, compileCompleters, compileCompleters, execute, hasCommand, invoke, namestatic String plainCommand(String command)
command - the name of the command to completevoid setLineReader(LineReader reader)
reader - LineReadervoid setSystemRegistry(SystemRegistry systemRegistry)
systemRegistry - SystemRegistryObject[] expandParameters(String[] args) throws Exception
args - the arguments to be expandedException - in case of errorString expandCommandLine(String line)
line - command line to be expandedString expandToList(List<String> params)
params - list of script parametersMap<String,Boolean> scripts()
void setScriptExtension(String extension)
extension - console script file extensionboolean hasAlias(String name)
name - alias nameString getAlias(String name)
name - alias nameList<String> getNamedPipes()
List<Completer> scriptCompleters()
void persist(Path file, Object object)
file - file where object should be writtenobject - object to persistObject slurp(Path file) throws IOException
file - file from where object should be readIOException<T> T consoleOption(String option, T defval)
T - option typeoption - option namedefval - default valueObject execute(String name, String rawLine, String[] args) throws Exception
name - parsed command/script namerawLine - raw command lineargs - parsed arguments of the commandException - in case of errordefault Object execute(File script) throws Exception
script - script fileException - in case of errorObject execute(File script, String rawLine, String[] args) throws Exception
script - script filerawLine - raw command lineargs - script argumentsException - in case of errorConsoleEngine.ExecutionResult postProcess(String line, Object result, String output)
line - command lineresult - command result to processoutput - command redirected outputConsoleEngine.ExecutionResult postProcess(Object result)
result - command result to processvoid trace(Object object)
object - object to printvoid println(Object object)
object - object to printvoid println(Map<String,Object> options, Object object)
options - println optionsobject - object to printvoid putVariable(String name, Object value)
name - name of the variablevalue - value of the variableObject getVariable(String name)
name - name of the variableboolean hasVariable(String name)
name - name of the variablevoid purge()
boolean executeWidget(Object function)
function - to executeboolean isExecuting()
Copyright © 2020. All rights reserved.