CommandRegistry
, SystemRegistry
public class SystemRegistryImpl extends Object implements SystemRegistry
Modifier and Type | Class | Description |
---|---|---|
protected static class |
SystemRegistryImpl.CommandData |
|
static class |
SystemRegistryImpl.Pipe |
CommandRegistry.CommandSession
SystemRegistry.Registeries
Constructor | Description |
---|---|
SystemRegistryImpl(Parser parser,
Terminal terminal,
Supplier<Path> workDir,
ConfigurationPath configPath) |
Modifier and Type | Method | Description |
---|---|---|
void |
cleanUp() |
Delete temporary console variables and reset output streams
|
void |
close() |
Orderly close SystemRegistry.
|
Map<String,String> |
commandAliases() |
Returns a map of alias-to-command names known by this registry.
|
Widgets.CmdDesc |
commandDescription(String command) |
Returns a command description for use in the JLine Widgets framework.
|
Widgets.CmdDesc |
commandDescription(Widgets.CmdLine line) |
Returns a command, method or syntax description for use in the JLine Widgets framework.
|
List<String> |
commandInfo(String command) |
Returns a short info about command known by this registry.
|
Set<String> |
commandNames() |
Returns the command names known by this registry.
|
Completers.SystemCompleter |
compileCompleters() |
Returns a
SystemCompleter that can provide detailed completion
information for all registered commands. |
Completer |
completer() |
Returns command completer that includes also console variable and script completion.
|
Object |
execute(String line) |
Execute a command, script or evaluate scriptEngine statement
|
Object |
execute(String command,
String[] args) |
Execute command with arguments
|
Collection<String> |
getPipeNames() |
|
boolean |
hasCommand(String command) |
Returns whether a command with the specified name is known to this registry.
|
void |
initialize(File script) |
Initialize consoleEngine environment by executing console script
|
Object |
invoke(String command,
Object... args) |
Execute command with arguments
|
Object |
localExecute(String command,
Object[] args) |
|
void |
register(String command,
CommandRegistry subcommandRegistry) |
Register subcommand registry
|
void |
rename(SystemRegistryImpl.Pipe pipe,
String name) |
|
void |
setCommandRegistries(CommandRegistry... commandRegistries) |
Set command registeries
|
Terminal |
terminal() |
|
void |
trace(boolean stack,
Exception exception) |
Print exception on terminal
|
void |
trace(Exception exception) |
Print exception on terminal
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute, invoke, name
public SystemRegistryImpl(Parser parser, Terminal terminal, Supplier<Path> workDir, ConfigurationPath configPath)
public void rename(SystemRegistryImpl.Pipe pipe, String name)
public Collection<String> getPipeNames()
getPipeNames
in interface SystemRegistry
public void setCommandRegistries(CommandRegistry... commandRegistries)
SystemRegistry
setCommandRegistries
in interface SystemRegistry
commandRegistries
- command registeries used by the applicationpublic void initialize(File script)
SystemRegistry
initialize
in interface SystemRegistry
script
- initialization scriptpublic Set<String> commandNames()
CommandRegistry
commandNames
in interface CommandRegistry
public Map<String,String> commandAliases()
CommandRegistry
commandAliases
in interface CommandRegistry
public void register(String command, CommandRegistry subcommandRegistry)
register
in interface SystemRegistry
command
- main commandsubcommandRegistry
- subcommand registrypublic List<String> commandInfo(String command)
CommandRegistry
commandInfo
in interface CommandRegistry
public boolean hasCommand(String command)
CommandRegistry
hasCommand
in interface CommandRegistry
command
- the command name to testpublic Completers.SystemCompleter compileCompleters()
CommandRegistry
SystemCompleter
that can provide detailed completion
information for all registered commands.compileCompleters
in interface CommandRegistry
public Completer completer()
SystemRegistry
completer
in interface SystemRegistry
public Widgets.CmdDesc commandDescription(String command)
CommandRegistry
commandDescription
in interface CommandRegistry
command
- name of the command whose description to returnpublic Widgets.CmdDesc commandDescription(Widgets.CmdLine line)
SystemRegistry
commandDescription
in interface SystemRegistry
line
- command line whose description to returnpublic Object invoke(String command, Object... args) throws Exception
SystemRegistry
invoke
in interface SystemRegistry
command
- command to be executedargs
- arguments of the commandException
- in case of errorpublic Object execute(String command, String[] args) throws Exception
SystemRegistry
execute
in interface SystemRegistry
command
- command to be executedargs
- arguments of the commandException
- in case of errorpublic Object localExecute(String command, Object[] args) throws Exception
Exception
public Terminal terminal()
terminal
in interface SystemRegistry
public Object execute(String line) throws Exception
SystemRegistry
execute
in interface SystemRegistry
line
- command line to be executedException
- in case of errorpublic void cleanUp()
SystemRegistry
cleanUp
in interface SystemRegistry
public void trace(Exception exception)
SystemRegistry
trace
in interface SystemRegistry
exception
- exception to print on terminalpublic void trace(boolean stack, Exception exception)
SystemRegistry
trace
in interface SystemRegistry
stack
- print stack trace if stack true otherwise messageexception
- exception to be printedpublic void close()
SystemRegistry
close
in interface SystemRegistry
Copyright © 2020. All rights reserved.