Package org.jline.console.impl
Class CommandRegistryAdapter
java.lang.Object
org.jline.console.impl.CommandRegistryAdapter
- All Implemented Interfaces:
CommandRegistry
Adapts a new
CommandGroup to the old CommandRegistry interface.
This bridge allows new-style command groups to be used with the legacy
SystemRegistryImpl and other old API consumers.
- Since:
- 4.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jline.console.CommandRegistry
CommandRegistry.CommandSession -
Constructor Summary
ConstructorsConstructorDescriptionCreates an adapter wrapping the given command group. -
Method Summary
Modifier and TypeMethodDescriptionReturns 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.commandInfo(String command) Returns a short info about command known by this registry.Returns the command names known by this registry.Returns aSystemCompleterthat can provide detailed completion information for all registered commands.booleanhasCommand(String command) Returns whether a command with the specified name is known to this registry.invoke(CommandRegistry.CommandSession session, String command, Object... args) Execute a command.name()Returns the name of this registry.
-
Constructor Details
-
CommandRegistryAdapter
Creates an adapter wrapping the given command group.- Parameters:
group- the new command group to adapt
-
-
Method Details
-
name
Description copied from interface:CommandRegistryReturns the name of this registry.- Specified by:
namein interfaceCommandRegistry- Returns:
- the name of the registry
-
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
-
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
-
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
-
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.
-
invoke
public Object invoke(CommandRegistry.CommandSession session, String command, Object... args) throws Exception Description copied from interface:CommandRegistryExecute a command.- Specified by:
invokein interfaceCommandRegistry- Parameters:
session- the data of the current command sessioncommand- the name of the commandargs- arguments of the command- Returns:
- result of the command execution
- Throws:
Exception- in case of error
-