Package org.jline.console
Class CommandMethods
java.lang.Object
org.jline.console.CommandMethods
Class that encapsulates the execution and completion methods for a command.
CommandMethods provides a way to associate a command execution function with a completer compilation function. This allows commands to be registered with both their execution logic and their completion logic in a single object.
-
Constructor Summary
ConstructorsConstructorDescriptionCommandMethods
(Consumer<CommandInput> execute, Function<String, List<Completer>> compileCompleter) Creates a new CommandMethods with the specified execution and completer compilation functions.CommandMethods
(Function<CommandInput, ?> execute, Function<String, List<Completer>> compileCompleter) Creates a new CommandMethods with the specified execution and completer compilation functions. -
Method Summary
Modifier and TypeMethodDescriptionReturns the function that compiles completers for the command.execute()
Returns the function that executes the command.
-
Constructor Details
-
CommandMethods
public CommandMethods(Function<CommandInput, ?> execute, Function<String, List<Completer>> compileCompleter) Creates a new CommandMethods with the specified execution and completer compilation functions.This constructor takes a function that returns a result when executing the command.
- Parameters:
execute
- the function that executes the command and returns a resultcompileCompleter
- the function that compiles completers for the command
-
CommandMethods
public CommandMethods(Consumer<CommandInput> execute, Function<String, List<Completer>> compileCompleter) Creates a new CommandMethods with the specified execution and completer compilation functions.This constructor takes a consumer that doesn't return a result when executing the command. The execution function is wrapped to return null after executing the consumer.
- Parameters:
execute
- the consumer that executes the command without returning a resultcompileCompleter
- the function that compiles completers for the command
-
-
Method Details
-
execute
Returns the function that executes the command.- Returns:
- the function that executes the command
-
compileCompleter
Returns the function that compiles completers for the command.- Returns:
- the function that compiles completers for the command
-