feat: 添加命令行参数解析和策略启动功能,支持静默模式和帮助信息

This commit is contained in:
discountry
2025-09-28 01:26:00 +08:00
parent 0e4ae67573
commit 5c1283fac2
4 changed files with 273 additions and 2 deletions
+18 -1
View File
@@ -2,7 +2,24 @@ import React from "react";
import { render } from "ink";
import { App } from "./ui/App";
import { setupGlobalErrorHandlers } from "./runtime-errors";
import { parseCliArgs, printCliHelp } from "./cli/args";
import { startStrategy } from "./cli/strategy-runner";
setupGlobalErrorHandlers();
const options = parseCliArgs();
render(<App />);
if (options.help) {
printCliHelp();
process.exit(0);
}
if (options.strategy) {
startStrategy(options.strategy, { silent: options.silent })
.catch((error) => {
const message = error instanceof Error ? error.message : String(error);
console.error(`[Strategy] Failed to start: ${message}`);
process.exit(1);
});
} else {
render(<App />);
}