Package org.jline.console.impl
Class SystemRegistryImpl
java.lang.Object
org.jline.console.impl.SystemRegistryImpl
- All Implemented Interfaces:
ConsoleOptionGetter,CommandRegistry,SystemRegistry
Aggregate command registries.
- Author:
- Matti Rinta-Nikkola
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic enumstatic classNested classes/interfaces inherited from interface org.jline.console.CommandRegistry
CommandRegistry.CommandSessionNested classes/interfaces inherited from interface org.jline.console.SystemRegistry
SystemRegistry.Registeries -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConfigurationPathprotected final org.jline.reader.Parser -
Constructor Summary
ConstructorsConstructorDescriptionSystemRegistryImpl(org.jline.reader.Parser parser, org.jline.terminal.Terminal terminal, Supplier<Path> workDir, ConfigurationPath configPath) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompleter(org.jline.reader.Completer completer) voidcleanUp()Delete temporary console variables and reset output streamsvoidclose()Orderly close SystemRegistry.Returns a map of alias-to-command names known by this registry.commandDescription(List<String> args) Returns a command description for use in the JLine Widgets framework.commandDescription(CmdLine line) Returns a command, method or syntax description for use in the JLine Widgets framework.commandInfo(String command) Returns a short info about command known by this registry.Returns the command names known by this registry.org.jline.reader.impl.completer.SystemCompleterReturns aSystemCompleterthat can provide detailed completion information for all registered commands.org.jline.reader.CompleterReturns command completer that includes also console variable and script completion.consoleOption(String name) Return console option value<T> TconsoleOption(String name, T defVal) Return console option valueExecute a command, script or evaluate scriptEngine statementgroupCommandsInHelp(boolean commandGroups) booleanhasCommand(String command) Returns whether a command with the specified name is known to this registry.voidinitialize(File script) Initialize consoleEngine environment by executing console scriptExecute command with argumentsbooleanisCommandAlias(String command) Returns whether alias is known command alias.booleanisCommandOrScript(String command) Returns whether command is known to this registry.booleanisCommandOrScript(org.jline.reader.ParsedLine line) Returns whether a line contains command/script that is known to this registry.voidregister(String command, CommandRegistry subcommandRegistry) Register subcommand registryvoidrename(SystemRegistryImpl.Pipe pipe, String name) voidsetCommandRegistries(CommandRegistry... commandRegistries) Set command registriesvoidsetConsoleOption(String name, Object value) Set console option valuevoidsetGroupCommandsInHelp(boolean commandGroups) voidsetScriptDescription(Function<CmdLine, CmdDesc> scriptDescription) org.jline.terminal.Terminalterminal()voidPrint exception on terminalvoidPrint exception on terminalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jline.console.CommandRegistry
invoke, name
-
Field Details
-
parser
protected final org.jline.reader.Parser parser -
configPath
-
workDir
-
-
Constructor Details
-
SystemRegistryImpl
public SystemRegistryImpl(org.jline.reader.Parser parser, org.jline.terminal.Terminal terminal, Supplier<Path> workDir, ConfigurationPath configPath)
-
-
Method Details
-
rename
-
getPipeNames
- Specified by:
getPipeNamesin interfaceSystemRegistry- Returns:
- pipe names defined in systemRegistry
-
setCommandRegistries
Description copied from interface:SystemRegistrySet command registries- Specified by:
setCommandRegistriesin interfaceSystemRegistry- Parameters:
commandRegistries- command registries used by the application
-
initialize
Description copied from interface:SystemRegistryInitialize consoleEngine environment by executing console script- Specified by:
initializein interfaceSystemRegistry- Parameters:
script- initialization script
-
commandNames
Description copied from interface:CommandRegistryReturns the command names known by this registry.- Specified by:
commandNamesin interfaceCommandRegistry- Returns:
- the set of known command names, excluding aliases
-
commandAliases
Description copied from interface:CommandRegistryReturns a map of alias-to-command names known by this registry.- Specified by:
commandAliasesin interfaceCommandRegistry- Returns:
- a map with alias keys and command name values
-
consoleOption
Description copied from interface:SystemRegistryReturn console option value- Specified by:
consoleOptionin interfaceConsoleOptionGetter- Specified by:
consoleOptionin interfaceSystemRegistry- Parameters:
name- the option name- Returns:
- option value
-
consoleOption
Description copied from interface:SystemRegistryReturn console option value- Specified by:
consoleOptionin interfaceConsoleOptionGetter- Specified by:
consoleOptionin interfaceSystemRegistry- Parameters:
name- the option namedefVal- value to return if console option does not exists- Returns:
- option value
-
setConsoleOption
Description copied from interface:SystemRegistrySet console option value- Specified by:
setConsoleOptionin interfaceSystemRegistry- Parameters:
name- the option namevalue- value to assign console option
-
register
Register subcommand registry- Specified by:
registerin interfaceSystemRegistry- Parameters:
command- main commandsubcommandRegistry- subcommand registry
-
commandInfo
Description copied from interface:CommandRegistryReturns a short info about command known by this registry.- Specified by:
commandInfoin interfaceCommandRegistry- Parameters:
command- the command name- Returns:
- a short info about command
-
hasCommand
Description copied from interface:CommandRegistryReturns whether a command with the specified name is known to this registry.- Specified by:
hasCommandin interfaceCommandRegistry- Parameters:
command- the command name to test- Returns:
- true if the specified command is registered
-
setGroupCommandsInHelp
public void setGroupCommandsInHelp(boolean commandGroups) -
groupCommandsInHelp
-
isCommandOrScript
public boolean isCommandOrScript(org.jline.reader.ParsedLine line) Description copied from interface:SystemRegistryReturns whether a line contains command/script that is known to this registry.- Specified by:
isCommandOrScriptin interfaceSystemRegistry- Parameters:
line- the parsed command line to test- Returns:
- true if the specified line has a command registered
-
isCommandOrScript
Description copied from interface:SystemRegistryReturns whether command is known to this registry.- Specified by:
isCommandOrScriptin interfaceSystemRegistry- Parameters:
command- the command to test- Returns:
- true if the specified command is known
-
addCompleter
public void addCompleter(org.jline.reader.Completer completer) -
compileCompleters
public org.jline.reader.impl.completer.SystemCompleter compileCompleters()Description copied from interface:CommandRegistryReturns aSystemCompleterthat can provide detailed completion information for all registered commands.- Specified by:
compileCompletersin interfaceCommandRegistry- Returns:
- a SystemCompleter that can provide command completion for all registered commands
-
completer
public org.jline.reader.Completer completer()Description copied from interface:SystemRegistryReturns command completer that includes also console variable and script completion.- Specified by:
completerin interfaceSystemRegistry- Returns:
- command completer
-
commandDescription
Description copied from interface:CommandRegistryReturns a command description for use in the JLine Widgets framework. Default method must be overridden to return sub command descriptions.- Specified by:
commandDescriptionin interfaceCommandRegistry- Parameters:
args- command (args[0]) and its arguments- Returns:
- command description for JLine TailTipWidgets to be displayed in the terminal status bar.
-
setScriptDescription
-
commandDescription
Description copied from interface:SystemRegistryReturns a command, method or syntax description for use in the JLine Widgets framework.- Specified by:
commandDescriptionin interfaceSystemRegistry- Parameters:
line- command line whose description to return- Returns:
- command description for JLine TailTipWidgets to be displayed in the terminal status bar.
-
invoke
Description copied from interface:SystemRegistryExecute command with arguments- Specified by:
invokein interfaceSystemRegistry- Parameters:
command- command to be executedargs- arguments of the command- Returns:
- command execution result
- Throws:
Exception- in case of error
-
terminal
public org.jline.terminal.Terminal terminal()- Specified by:
terminalin interfaceSystemRegistry- Returns:
- terminal
-
isCommandAlias
Description copied from interface:SystemRegistryReturns whether alias is known command alias.- Specified by:
isCommandAliasin interfaceSystemRegistry- Parameters:
command- the alias to test- Returns:
- true if the alias is known command alias
-
execute
Description copied from interface:SystemRegistryExecute a command, script or evaluate scriptEngine statement- Specified by:
executein interfaceSystemRegistry- Parameters:
line- command line to be executed- Returns:
- execution result
- Throws:
Exception- in case of error
-
cleanUp
public void cleanUp()Description copied from interface:SystemRegistryDelete temporary console variables and reset output streams- Specified by:
cleanUpin interfaceSystemRegistry
-
trace
Description copied from interface:SystemRegistryPrint exception on terminal- Specified by:
tracein interfaceSystemRegistry- Parameters:
exception- exception to print on terminal
-
trace
Description copied from interface:SystemRegistryPrint exception on terminal- Specified by:
tracein interfaceSystemRegistry- Parameters:
stack- print stack trace if stack true otherwise messageexception- exception to be printed
-
close
public void close()Description copied from interface:SystemRegistryOrderly close SystemRegistry.- Specified by:
closein interfaceSystemRegistry
-
consoleEngine
-