菜单优化
This commit is contained in:
@@ -26,10 +26,28 @@ public interface Tool {
|
||||
*/
|
||||
String[] getMenuOptions();
|
||||
|
||||
/**
|
||||
* 命令行模式下的命令名,如 "sql", "scan", "batch"
|
||||
* 返回空字符串表示不支持命令行模式
|
||||
*/
|
||||
default String getCommandName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行工具的交互会话
|
||||
*
|
||||
* @param scanner 控制台输入
|
||||
*/
|
||||
void execute(Scanner scanner);
|
||||
|
||||
/**
|
||||
* 命令行模式执行(无交互)
|
||||
* 默认实现打印不支持提示
|
||||
*
|
||||
* @param args 命令行参数(不含命令名本身)
|
||||
*/
|
||||
default void executeCommand(String... args) throws Exception {
|
||||
System.out.println("工具 [" + getName() + "] 不支持命令行模式");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user