Skip to content

feat(libra): 为libra config命令添加--name-only参数#1229

Merged
genedna merged 7 commits into
gitmono-dev:mainfrom
InChh:pre-task
Jul 15, 2025
Merged

feat(libra): 为libra config命令添加--name-only参数#1229
genedna merged 7 commits into
gitmono-dev:mainfrom
InChh:pre-task

Conversation

@InChh

@InChh InChh commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

关联issue

此 PR 完成了 r2cn 测试任务 #1226 为libra config命令添加 --name-only 参数

效果

1.该参数只能与--list配合使用
2.当仅给出--list参数时,输出所有配置项的"key=value"
3.当同时给出--list和--name-only参数时,则仅输出所有配置项的"key"
4.当仅给出--name-only参数时,提示错误并退出。

思路

1.修改src/command/config.rs下的ConfigArgs结构体,添加新bool类型字段name_only
2.修改同一文件下的list_config()函数,添加函数bool类型的参数name_only
3.修改list_config(name_only: bool)函数,若name_only参数为true,则遍历configurations时仅打印"{key}";若name_only参数为false,则遍历时打印"{key}={value}"
4.在tests/command/config_test.rs中添加测试用例

Signed-off-by: InChh <2319397152@qq.com>
Copilot AI review requested due to automatic review settings July 14, 2025 15:10
@vercel

vercel Bot commented Jul 14, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 6:15am

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a --name-only parameter to the libra config command that allows users to list only configuration keys instead of key=value pairs. The feature requires the --list flag to be present and provides error handling when used incorrectly.

Key changes:

  • Added name_only field to ConfigArgs struct with appropriate CLI validation
  • Modified list_config() function to conditionally output keys only or key=value pairs
  • Added comprehensive test coverage for the new functionality including error cases

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
libra/src/command/config.rs Added name_only field to ConfigArgs, implemented validation logic, and modified list_config function to support name-only output
libra/tests/command/config_test.rs Updated existing tests to include the new field and added three new test cases for list functionality
aria/contents/docs/libra/command/config/index.mdx Updated documentation to describe the new --name-only parameter

Comment thread libra/src/command/config.rs Outdated
Comment thread libra/src/command/config.rs Outdated
Comment thread libra/tests/command/config_test.rs Outdated
genedna and others added 2 commits July 15, 2025 09:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>
InChh and others added 2 commits July 15, 2025 11:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>
@genedna
genedna added this pull request to the merge queue Jul 15, 2025
Merged via the queue into gitmono-dev:main with commit fed250d Jul 15, 2025
12 checks passed
liuyangjuncong20202570 pushed a commit to liuyangjuncong20202570/mega that referenced this pull request Jul 20, 2025
* feat(libra): 为libra config命令添加--name-only参数

Signed-off-by: InChh <2319397152@qq.com>

* Update libra/src/command/config.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>

* Update libra/tests/command/config_test.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>

* Update libra/src/command/config.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>

* Update libra/src/command/config.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: InChh <2319397152@qq.com>

---------

Signed-off-by: InChh <2319397152@qq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Quanyi Ma <eli@patch.sh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants