public class SystemRegistryImpl
extends Object
implements SystemRegistry
Aggregate command registries.
| Modifiers | Name | Description |
|---|---|---|
protected static class |
SystemRegistryImpl.CommandData |
Holds parsed command data for pipeline execution. |
enum |
SystemRegistryImpl.Pipe |
Pipe operators used to connect commands in a pipeline. |
static class |
SystemRegistryImpl.UnknownCommandException |
Exception thrown when a command is not recognized. |
| Modifiers | Name | Description |
|---|---|---|
protected ConfigurationPath |
configPath |
Configuration path for storing user-specific settings |
protected Parser |
parser |
The parser used for command line parsing |
protected Supplier<Path> |
workDir |
Supplier for the working directory |
| Constructor and description |
|---|
SystemRegistryImpl(Parser parser, Terminal terminal, Supplier<Path> workDir, ConfigurationPath configPath)Constructs a new SystemRegistryImpl. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addCompleter(Completer completer)Adds a completer to the registry. |
|
public void |
cleanUp()Cleans up output streams and purges temporary data. |
|
public void |
close()Persists collected command names before shutdown. |
|
public Map<String, String> |
commandAliases()Returns all command aliases. |
|
public CmdDesc |
commandDescription(List<String> args)Returns the description for a command given its arguments. |
|
public CmdDesc |
commandDescription(CmdLine line)Returns the description for a command line. |
|
public List<String> |
commandInfo(String command)Returns the help information for a command. |
|
public Set<String> |
commandNames()Returns the names of all registered commands. |
|
public SystemCompleter |
compileCompleters()Compiles all registered completers into a system completer. |
|
public Completer |
completer()Returns the completer for all registered commands and scripts. |
|
public ConsoleEngine |
consoleEngine()Returns the console engine, if available. |
|
public Object |
consoleOption(String name)Retrieves a console option value. |
<T> |
public T |
consoleOption(String name, T defVal)Retrieves a console option value with a default. |
|
public Object |
execute(String line)Executes a command line, including pipes, redirection, and console statements. |
|
public Collection<String> |
getPipeNames()Returns the names of all pipe operators. |
|
public SystemRegistryImpl |
groupCommandsInHelp(boolean commandGroups)Sets whether commands should be grouped by registry in help output. |
|
public boolean |
hasCommand(String command)Checks if a command exists. |
|
public void |
initialize(File script)Initializes the system by executing a startup script. |
|
public Object |
invoke(String command, Object args)Invokes a command with the given arguments. |
|
public boolean |
isCommandAlias(String command)Checks if the command is an alias. |
|
public boolean |
isCommandOrScript(ParsedLine line)Checks if the parsed line represents a command or script. |
|
public boolean |
isCommandOrScript(String command)Checks if the given string represents a command or script. |
|
public void |
register(String command, CommandRegistry subcommandRegistry)Register subcommand registry |
|
public void |
rename(SystemRegistryImpl.Pipe pipe, String name)Renames a pipe operator. |
|
public void |
renameLocal(String command, String newName)Renames a local command. |
|
public void |
setCommandRegistries(CommandRegistry commandRegistries)Sets the command registries managed by this system registry. |
|
public void |
setConsoleOption(String name, Object value)Sets a console option value. |
|
public void |
setGroupCommandsInHelp(boolean commandGroups)Sets whether commands should be grouped by registry in help output. |
|
public void |
setScriptDescription(Function<CmdLine, CmdDesc> scriptDescription)Sets the function used to describe scripts for tab completion. |
|
public Terminal |
terminal()Returns the terminal associated with this registry. |
|
public void |
trace(Throwable exception)Reports an exception using the configured console-aware tracing strategy. |
|
public void |
trace(boolean stack, Throwable exception)Reports an exception, optionally printing its full stack trace. |
Configuration path for storing user-specific settings
The parser used for command line parsing
Constructs a new SystemRegistryImpl.
parser - the parser for command line parsingterminal - the terminal to use for input/outputworkDir - supplier for the working directoryconfigPath - configuration path for user-specific settingsAdds a completer to the registry.
completer - the completer to addCleans up output streams and purges temporary data.
Persists collected command names before shutdown.
Returns all command aliases.
Returns the description for a command given its arguments.
args - the command argumentsReturns the description for a command line.
line - the command lineReturns the help information for a command.
command - the command nameReturns the names of all registered commands.
Compiles all registered completers into a system completer.
Returns the completer for all registered commands and scripts.
Returns the console engine, if available.
Retrieves a console option value.
name - the option namenull if not foundRetrieves a console option value with a default.
T - the option value typename - the option namedefVal - the default valueExecutes a command line, including pipes, redirection, and console statements.
line - command line to executeReturns the names of all pipe operators.
Sets whether commands should be grouped by registry in help output.
commandGroups - true to group commands, false otherwiseChecks if a command exists.
command - the command nametrue if the command exists, false otherwiseInitializes the system by executing a startup script.
script - the script file to executeInvokes a command with the given arguments.
command - the command nameargs - the command argumentsChecks if the command is an alias.
command - the command nametrue if the command is an alias, false otherwiseChecks if the parsed line represents a command or script.
line - the parsed line to checktrue if the line is a command or script, false otherwiseChecks if the given string represents a command or script.
command - the command name to checktrue if the command or script exists, false otherwiseRegister subcommand registry
command - main commandsubcommandRegistry - subcommand registryRenames a pipe operator.
pipe - the pipe to renamename - the new nameRenames a local command.
command - the command to renamenewName - the new name for the commandSets the command registries managed by this system registry.
commandRegistries - the command registries to setSets a console option value.
name - the option namevalue - the option valueSets whether commands should be grouped by registry in help output.
commandGroups - true to group commands, false otherwiseSets the function used to describe scripts for tab completion.
scriptDescription - the script description functionReturns the terminal associated with this registry.
Reports an exception using the configured console-aware tracing strategy.
exception - exception to reportReports an exception, optionally printing its full stack trace.
stack - whether to print the full stack traceexception - exception to reportCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.