Package sqlline
Interface CommandHandler
- All Known Implementing Classes:
AbstractCommandHandler
,ReflectiveCommandHandler
public interface CommandHandler
A generic command to be executed. Execution of the command should be
dispatched to the
execute(String, DispatchCallback)
method after
determining that the command is appropriate with the
matches(String)
method.-
Method Summary
Modifier and Type Method Description boolean
echoToFile()
Returns whether the command should be written to the output file of the!script
command.void
execute(java.lang.String line, DispatchCallback dispatchCallback)
Executes the specified command.java.lang.String
getHelpText()
java.lang.String
getName()
java.util.List<java.lang.String>
getNames()
java.util.List<org.jline.reader.Completer>
getParameterCompleters()
Returns the completers that can handle parameters.java.lang.String
matches(java.lang.String line)
Checks to see if the specified string can be dispatched to this command.
-
Method Details
-
getName
java.lang.String getName()- Returns:
- the name of the command
-
getNames
java.util.List<java.lang.String> getNames()- Returns:
- all the possible names of this command.
-
getHelpText
java.lang.String getHelpText()- Returns:
- the short help description for this command.
-
matches
java.lang.String matches(java.lang.String line)Checks to see if the specified string can be dispatched to this command.- Parameters:
line
- The command line to check- Returns:
- the command string that matches, or null if it no match
-
execute
Executes the specified command.- Parameters:
line
- The full command line to executedispatchCallback
- the callback to check or interrupt the action
-
getParameterCompleters
java.util.List<org.jline.reader.Completer> getParameterCompleters()Returns the completers that can handle parameters.- Returns:
- Completers that can handle parameters
-
echoToFile
boolean echoToFile()Returns whether the command should be written to the output file of the!script
command.Returns
true
by default, but the!script
command hides itself by returningfalse
.- Returns:
- true if command should be written to file
-