refactor: move subcommands to separate modules#3099
Merged
Conversation
1caedc8 to
6aec07d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the CLI implementation by moving several subcommands and helpers out of main.rs into dedicated modules, and introduces a shared test helper for resolving test-crates paths.
Changes:
- Extracted CLI subcommand implementations (build/publish/sdist/develop/pep517, etc.) into
src/commands/*. - Added
test_crate_pathhelper and updated tests to use it instead of hard-codedtest-crates/...paths. - Adjusted SBOM fallback code to silence unused-variable warnings when the
sbomfeature is disabled.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test_utils.rs | Adds a shared helper to resolve paths under test-crates for tests. |
| src/sbom.rs | Updates non-sbom feature branch to mark parameters as unused. |
| src/pyproject_toml.rs | Uses test_crate_path in tests to locate fixture pyproject.toml. |
| src/metadata.rs | Uses test_crate_path in tests and avoids hard-coded fixture paths. |
| src/main.rs | Replaces inlined subcommand logic with calls into commands::* modules. |
| src/lib.rs | Exposes test_utils module for tests via #[cfg(test)]. |
| src/commands/mod.rs | New command module hub plus shared CLI helpers/options. |
| src/commands/utils.rs | New shared helpers for building/unpacking sdists. |
| src/commands/build.rs | Extracted build command implementation. |
| src/commands/publish.rs | Extracted publish command implementation. |
| src/commands/sdist.rs | Extracted sdist command implementation. |
| src/commands/develop.rs | Extracted develop command implementation and venv detection. |
| src/commands/pep517.rs | Extracted PEP517 subcommand enum and dispatch function. |
| src/build_options.rs | Updates tests to use test_crate_path for fixture manifests. |
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.
No description provided.