Files
yinx-cli/index.js
2025-12-20 11:51:35 +08:00

29 lines
795 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
import color from "picocolors";
import { showMainMenu } from "./lib/menu.js";
while (true) {
const selected = await showMainMenu();
console.clear();
console.log(color.cyan("\n正在启动: " + selected.name + "...\n"));
try {
const tool = await import(selected.module);
const result = await tool.run();
if (result === "back") continue;
break;
} catch (err) {
console.log(color.yellow("\n⚠ " + selected.name + " 模块尚未实现"));
console.log(color.dim(err.message));
console.log(color.dim("\n按任意键返回主菜单..."));
await new Promise(resolve => {
process.stdin.setRawMode(true);
process.stdin.once("data", () => {
process.stdin.setRawMode(false);
resolve();
});
});
}
}