Skip to content

fix: support --help for apt and file-log plugins.#3798

Merged
jarhodes314 merged 1 commit intothin-edge:mainfrom
jarhodes314:fix/plugin-fancy-output
Oct 3, 2025
Merged

fix: support --help for apt and file-log plugins.#3798
jarhodes314 merged 1 commit intothin-edge:mainfrom
jarhodes314:fix/plugin-fancy-output

Conversation

@jarhodes314
Copy link
Copy Markdown
Contributor

@jarhodes314 jarhodes314 commented Sep 29, 2025

Proposed changes

We handle apt plugin 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

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s. You can activate automatic signing by running just prepare-dev once)
  • I ran just format as mentioned in CODING_GUIDELINES
  • I used just check as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 29, 2025

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
709 0 3 709 100 2h12m53.198428999s

Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Formally approved. This nicely restores the colorful help that has been lost with the quick fix fbdb363. However, better to merge this only after #3798 actually merged.

#[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)]
Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek Sep 29, 2025

Choose a reason for hiding this comment

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

Adding the case where no args are provided, as this was one of the incorrect case.

    #[test_case("tedge-file-log-plugin", 1)]

Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek Oct 3, 2025

Choose a reason for hiding this comment

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

There is a clippy warning to tell you added the very same line instead of the proposed one ;-)

Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved

#[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)]
Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek Oct 3, 2025

Choose a reason for hiding this comment

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

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>
@jarhodes314 jarhodes314 force-pushed the fix/plugin-fancy-output branch from d4073ec to 5582d37 Compare October 3, 2025 09:02
@jarhodes314 jarhodes314 temporarily deployed to Test Pull Request October 3, 2025 09:02 — with GitHub Actions Inactive
@jarhodes314 jarhodes314 added this pull request to the merge queue Oct 3, 2025
Merged via the queue into thin-edge:main with commit 3ac2d83 Oct 3, 2025
34 checks passed
@reubenmiller reubenmiller added the theme:cli Theme: cli related topics label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:cli Theme: cli related topics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants