优化第一阶段
This commit is contained in:
6
index.js
6
index.js
@ -33,7 +33,11 @@ while (true) {
|
||||
console.log(color.cyan("\n正在启动: " + selected.name + "...\n"));
|
||||
|
||||
try {
|
||||
const result = await selected.tool.run();
|
||||
const runner = selected.run || selected.tool?.run;
|
||||
if (typeof runner !== "function") {
|
||||
throw new Error("当前菜单项缺少 run 方法");
|
||||
}
|
||||
const result = await runner();
|
||||
if (result === "back") continue;
|
||||
break;
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user