菜单优化

This commit is contained in:
张家训
2026-06-08 17:40:57 +08:00
parent ecdfb1f1a1
commit b76a2a451e
11 changed files with 295 additions and 223 deletions
@@ -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() + "] 不支持命令行模式");
}
}