feat(libra): 为libra config命令添加--name-only参数#1229
Merged
Merged
Conversation
Signed-off-by: InChh <2319397152@qq.com>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: InChh <2319397152@qq.com>
Contributor
There was a problem hiding this comment.
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_onlyfield toConfigArgsstruct 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 |
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>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: InChh <2319397152@qq.com>
genedna
approved these changes
Jul 15, 2025
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联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中添加测试用例