fix(3197): fix youki version command Part of Enhancing Compatibility with runc#3200
fix(3197): fix youki version command Part of Enhancing Compatibility with runc#3200utam0k merged 4 commits intoyouki-dev:mainfrom
Conversation
…with runc Signed-off-by: tommady <[email protected]>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the youki version command to enhance compatibility with runc by updating the version output format and command-line interface behavior. The changes ensure that youki -v or youki --version produces output in a Moby-compatible format.
- Modified CLI argument parsing to handle version flag separately instead of using a macro
- Updated version output format to match Moby/runc compatibility requirements
- Changed subcommand handling to be optional and display help when no subcommand is provided
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/youki/src/main.rs | Updated CLI parsing to add explicit version flag handling and made subcommands optional |
| crates/youki/src/commands/info.rs | Modified version output format to be Moby-compatible |
|
|
||
| #[clap(subcommand)] | ||
| subcmd: SubCommand, | ||
| subcmd: Option<SubCommand>, |
There was a problem hiding this comment.
Making subcmd optional changes the CLI behavior significantly. Consider if this is the intended breaking change, as users who previously relied on subcommands being required may experience different behavior.
| subcmd: Option<SubCommand>, | |
| subcmd: SubCommand, |
crates/youki/src/main.rs
Outdated
| } | ||
| None => Opts::command() | ||
| .print_help() | ||
| .map_err(|e| anyhow::anyhow!(":{e}")), |
There was a problem hiding this comment.
The error message format ":{e}" has an unusual leading colon. Consider using a more descriptive format like "Failed to print help: {e}".
| .map_err(|e| anyhow::anyhow!(":{e}")), | |
| .map_err(|e| anyhow::anyhow!("Failed to print help: {e}")), |
|
@saku3 May I ask you to review this P? |
|
Sure! |
Signed-off-by: tommady <[email protected]>
crates/youki/src/main.rs
Outdated
| Some(SubCommand::Completion(completion)) => { | ||
| commands::completion::completion(completion, &mut app) | ||
| } | ||
| None => Opts::command() |
There was a problem hiding this comment.
| None => Opts::command() | |
| None => app.print_help().map_err(|e| anyhow::anyhow!(":{e}")) |
Signed-off-by: tommady <[email protected]>
|
Thanks. I think this modification looks good. |
|
Could you add the tests to keep this compatibility with runc? |
Signed-off-by: tommady <[email protected]>
sorry I am not quite sure how, could you guide me? I thought the issue's goal is to let youki accept |
Hey, so that is correct, utam0k is asking to add test, so we can be safe against regression with this. The test for this would be running youki with Also do should we support Thanks :) |
I think you’ve highlighted two key points: These two directly affect your suggestions: In any case, I think we should keep this PR simple and focused, as requested by the original issue. |
In my opinion, we don't need backward compatibility in this case. Not many people currently depend on this behavior.
After reading YJDoc's comments, I reconsidered. I don't think it's necessary to test using new methods. I vote against no testing. |
Do you think the manual test is OK for you? |
Yes, I think, but wait for @YJDoc2 |
|
Hey, I'm also fine with manual test for this. |
…with runc (youki-dev#3200) * fix(3197): fix youki version command Part of Enhancing Compatibility with runc Signed-off-by: tommady <[email protected]> * fix copilot review on print help suggestion Signed-off-by: tommady <[email protected]> * address command Signed-off-by: tommady <[email protected]> * address comment Signed-off-by: tommady <[email protected]> --------- Signed-off-by: tommady <[email protected]>
Description
Fix Youki version command
This is Part of Enhancing Compatibility with runc
Type of Change
Testing
Related Issues
Fixes #3197
Additional Context