fix: support --help for apt and file-log plugins.#3798
Merged
jarhodes314 merged 1 commit intothin-edge:mainfrom Oct 3, 2025
Merged
fix: support --help for apt and file-log plugins.#3798jarhodes314 merged 1 commit intothin-edge:mainfrom
--help for apt and file-log plugins.#3798jarhodes314 merged 1 commit intothin-edge:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Contributor
Robot Results
|
crates/core/tedge/src/main.rs
Outdated
| #[test_case("tedge-apt-plugin --help", 0)] | ||
| #[test_case("tedge-apt-plugin unknownarg", 1)] | ||
| #[test_case("file unknownarg", 1)] | ||
| #[test_case("tedge-file-log-plugin unknownarg", 1)] |
Contributor
There was a problem hiding this comment.
Adding the case where no args are provided, as this was one of the incorrect case.
#[test_case("tedge-file-log-plugin", 1)]
Contributor
There was a problem hiding this comment.
There is a clippy warning to tell you added the very same line instead of the proposed one ;-)
1e4a8b7 to
4363f4f
Compare
4363f4f to
d4073ec
Compare
didier-wenzek
approved these changes
Oct 3, 2025
crates/core/tedge/src/main.rs
Outdated
| #[test_case("tedge-apt-plugin --help", 0)] | ||
| #[test_case("tedge-apt-plugin unknownarg", 1)] | ||
| #[test_case("file unknownarg", 1)] | ||
| #[test_case("tedge-file-log-plugin unknownarg", 1)] |
Contributor
There was a problem hiding this comment.
There is a clippy warning to tell you added the very same line instead of the proposed one ;-)
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
d4073ec to
5582d37
Compare
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.
Proposed changes
We handle
aptplugin parsing errors to ensure the exit code is 1, to adhere to the plugin interface. However, in doing so, we accidentally mishandled clap error output.This PR leans more heavily on the clap APIs for printing error information, and ensures we exit as expected (0 if the user requests
--help, 1 if a plugin encounters an error parsing arguments, 2 if another tedge binary encounters an error parsing arguments). It also adds support for unit testing the exit codes.Types of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments