public class Builtins extends Object implements CommandRegistry
| Modifier and Type | Class and Description |
|---|---|
static class |
Builtins.Command |
static class |
Builtins.CommandInput |
static class |
Builtins.CommandMethods |
CommandRegistry.CommandSession| Constructor and Description |
|---|
Builtins(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) |
Builtins(Supplier<Path> workDir,
ConfigurationPath configPath,
Function<String,Widget> widgetCreator) |
| Modifier and Type | Method and 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, waitaggregateCompleters, commandDescription, commandInfo, compileCompleters, invoke, namepublic 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()
CommandRegistrycommandNames in interface CommandRegistrypublic Map<String,String> commandAliases()
CommandRegistrycommandAliases in interface CommandRegistrypublic void setLineReader(LineReader reader)
public void rename(Builtins.Command command, String newName)
public boolean hasCommand(String name)
CommandRegistryhasCommand in interface CommandRegistryname - the command name to testpublic Completers.SystemCompleter compileCompleters()
CommandRegistrySystemCompleter that can provide detailed completion
information for all registered commands.compileCompleters in interface CommandRegistrypublic Object execute(CommandRegistry.CommandSession session, String command, String[] args) throws Exception
CommandRegistryexecute in interface CommandRegistrysession - 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.