CommandRegistry
public class Builtins extends Object implements CommandRegistry
Modifier and Type | Class | Description |
---|---|---|
static class |
Builtins.Command |
|
static class |
Builtins.CommandInput |
|
static class |
Builtins.CommandMethods |
CommandRegistry.CommandSession
Constructor | Description |
---|---|
Builtins(Path workDir,
ConfigurationPath configPath,
Function<String,Widget> widgetCreator) |
|
Builtins(Supplier<Path> workDir,
ConfigurationPath configPath,
Function<String,Widget> widgetCreator) |
|
Builtins(Set<Builtins.Command> commands,
Path workDir,
ConfigurationPath configpath,
Function<String,Widget> widgetCreator) |
|
Builtins(Set<Builtins.Command> commands,
Supplier<Path> workDir,
ConfigurationPath configpath,
Function<String,Widget> widgetCreator) |
Modifier and Type | Method | Description |
---|---|---|
void |
alias(String alias,
String command) |
|
Map<String,String> |
commandAliases() |
Returns a map of alias-to-command names known by this registry.
|
Set<String> |
commandNames() |
Returns the command names known by this registry.
|
static Widgets.CmdDesc |
compileCommandDescription(String helpMessage) |
|
static List<String> |
compileCommandInfo(String helpMessage) |
|
static List<Completers.OptDesc> |
compileCommandOptions(String helpMessage) |
|
Completers.SystemCompleter |
compileCompleters() |
Returns a
SystemCompleter that can provide detailed completion
information for all registered commands. |
Object |
execute(CommandRegistry.CommandSession session,
String command,
String[] args) |
Execute a command that have only string parameters and options.
|
boolean |
hasCommand(String name) |
Returns whether a command with the specified name is known to this registry.
|
void |
rename(Builtins.Command command,
String newName) |
|
void |
setLineReader(LineReader reader) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
commandDescription, commandInfo, invoke, name
public Builtins(Path workDir, ConfigurationPath configPath, Function<String,Widget> widgetCreator)
public Builtins(Set<Builtins.Command> commands, Path workDir, ConfigurationPath configpath, Function<String,Widget> widgetCreator)
public Builtins(Supplier<Path> workDir, ConfigurationPath configPath, Function<String,Widget> widgetCreator)
public Builtins(Set<Builtins.Command> commands, Supplier<Path> workDir, ConfigurationPath configpath, Function<String,Widget> widgetCreator)
public Set<String> commandNames()
CommandRegistry
commandNames
in interface CommandRegistry
public Map<String,String> commandAliases()
CommandRegistry
commandAliases
in interface CommandRegistry
public void setLineReader(LineReader reader)
public void rename(Builtins.Command command, String newName)
public boolean hasCommand(String name)
CommandRegistry
hasCommand
in interface CommandRegistry
name
- 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 Object execute(CommandRegistry.CommandSession session, String command, String[] args) throws Exception
CommandRegistry
execute
in interface CommandRegistry
session
- the data of the current command sessioncommand
- the name of the commandargs
- arguments of the commandException
- in case of errorpublic static Widgets.CmdDesc compileCommandDescription(String helpMessage)
public static List<Completers.OptDesc> compileCommandOptions(String helpMessage)
Copyright © 2020. All rights reserved.