Package org.jline.console
Interface ConsoleEngine
- All Superinterfaces:
CommandRegistry
- All Known Implementing Classes:
ConsoleEngineImpl
Manage console variables, commands and script executions.
- Author:
- Matti Rinta-Nikkola
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static class
Nested classes/interfaces inherited from interface org.jline.console.CommandRegistry
CommandRegistry.CommandSession
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Console string variable of nanorc file full path -
Method Summary
Modifier and TypeMethodDescription<T> T
consoleOption
(String option, T defval) Read console option valuedefault Object
Executes either JLine or ScriptEngine script.Executes either JLine or ScriptEngine script.Executes command line that does not contain known command by the system registry.boolean
executeWidget
(Object function) Execute widget functionexpandCommandLine
(String line) Substitutes command line with system registry invoke method call.Object[]
expandParameters
(String[] args) Substituting args references with their values.expandToList
(List<String> params) Expands parameter list to stringReturns alias 'name' valueReturns named pipe namesgetPipes()
Returns defined pipesgetVariable
(String name) Get variable valueboolean
Returns true if alias 'name' existsboolean
hasVariable
(String name) Test if variable with name existsboolean
Checks if consoleEngine is executing scriptvoid
Persist object to filestatic String
plainCommand
(String command) Removes the command name first character if it is colonpostProcess
(Object result) Post processes execution result.postProcess
(String line, Object result, String output) Post processes execution result.void
Print object.void
purge()
Delete temporary console variablesvoid
putVariable
(String name, Object value) Create console variableReturns script and variable completersscripts()
Returns all scripts found from PATHvoid
setConsoleOption
(String name, Object value) Set console option valuevoid
setLineReader
(LineReader reader) Sets lineReadervoid
setScriptExtension
(String extension) Sets file name extension used by console scriptsvoid
setSystemRegistry
(SystemRegistry systemRegistry) Sets systemRegistryRead object from filevoid
Print object if trace is enabledMethods inherited from interface org.jline.console.CommandRegistry
commandAliases, commandDescription, commandInfo, commandNames, compileCompleters, hasCommand, invoke, name
-
Field Details
-
VAR_NANORC
-
-
Method Details
-
plainCommand
-
setLineReader
-
setSystemRegistry
Sets systemRegistry- Parameters:
systemRegistry
- SystemRegistry
-
expandParameters
-
expandCommandLine
-
expandToList
-
scripts
-
setScriptExtension
Sets file name extension used by console scripts- Parameters:
extension
- console script file extension
-
hasAlias
Returns true if alias 'name' exists- Parameters:
name
- alias name- Returns:
- true if alias exists
-
getAlias
-
getPipes
-
getNamedPipes
-
scriptCompleters
-
persist
-
slurp
Read object from file- Parameters:
file
- file from where object should be read- Returns:
- object
- Throws:
IOException
- in case of error
-
consoleOption
Read console option value- Type Parameters:
T
- option type- Parameters:
option
- option namedefval
- default value- Returns:
- option value
-
setConsoleOption
-
execute
Executes command line that does not contain known command by the system registry. If the line is neither JLine or ScriptEngine script it will be evaluated as ScriptEngine statement.- Parameters:
name
- parsed command/script namerawLine
- raw command lineargs
- parsed arguments of the command- Returns:
- command line execution result
- Throws:
Exception
- in case of error
-
execute
-
execute
-
postProcess
Post processes execution result. If result is to be assigned to the console variable then method will return null.- Parameters:
line
- command lineresult
- command result to processoutput
- command redirected output- Returns:
- processed result
-
postProcess
Post processes execution result.- Parameters:
result
- command result to process- Returns:
- processed result
-
trace
-
println
-
putVariable
-
getVariable
-
hasVariable
Test if variable with name exists- Parameters:
name
- name of the variable- Returns:
- true if variable with name exists
-
purge
void purge()Delete temporary console variables -
executeWidget
Execute widget function- Parameters:
function
- to execute- Returns:
- true on success
-
isExecuting
boolean isExecuting()Checks if consoleEngine is executing script- Returns:
- true when executing script
-