[PR #344] refactor: 用声明式定义表替换 CLI 参数解析的 if-else 链 #345

Open
opened 2026-02-27 07:19:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/justlovemaki/AIClient-2-API/pull/344
Author: @lly835
Created: 2/26/2026
Status: 🔄 Open

Base: mainHead: refactor/config-cli-parsing


📝 Commits (1)

  • 1aa691e refactor: 用声明式定义表替换 CLI 参数解析的 if-else 链

📊 Changes

1 file changed (+43 additions, -93 deletions)

View changed files

📝 src/core/config-manager.js (+43 -93)

📄 Description

将 12 个 CLI 参数的手写 if-else 链(约 100 行)重构为数据驱动的声明式定义表,支持 string/int/bool/enum 四种类型自动解析。

  • 新增参数只需在 cliArgDefs 数组中添加一行
  • 净减 50 行重复代码
  • 保持完全相同的解析行为和警告输出

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/justlovemaki/AIClient-2-API/pull/344 **Author:** [@lly835](https://github.com/lly835) **Created:** 2/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `refactor/config-cli-parsing` --- ### 📝 Commits (1) - [`1aa691e`](https://github.com/justlovemaki/AIClient-2-API/commit/1aa691e70b7f1f2c3e8659f2d43daae45d2df23e) refactor: 用声明式定义表替换 CLI 参数解析的 if-else 链 ### 📊 Changes **1 file changed** (+43 additions, -93 deletions) <details> <summary>View changed files</summary> 📝 `src/core/config-manager.js` (+43 -93) </details> ### 📄 Description 将 12 个 CLI 参数的手写 if-else 链(约 100 行)重构为数据驱动的声明式定义表,支持 string/int/bool/enum 四种类型自动解析。 - 新增参数只需在 cliArgDefs 数组中添加一行 - 净减 50 行重复代码 - 保持完全相同的解析行为和警告输出 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#345
No description provided.