mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
feat: 添加命令行参数解析和策略启动功能,支持静默模式和帮助信息
This commit is contained in:
+18
-1
@@ -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 />);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user