-
Notifications
You must be signed in to change notification settings - Fork 133
feat: Uninstall a specific version (adds --version) #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ions of the same tool are installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds the ability to uninstall a specific version of a package instead of removing all installed versions. A new -v/--version flag is added to the uninstall command to specify which version to remove.
- Modified
Mint.uninstall()to accept an optional version parameter and implement version-specific uninstallation logic - Added
-v/--versionflag to UninstallCommand - Implemented logic to preserve package metadata and remaining versions when only specific versions are removed
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Sources/MintCLI/Commands/UninstallCommand.swift | Adds the --version parameter to the uninstall command |
| Sources/MintKit/Mint.swift | Updates the uninstall method to support removing specific versions with fuzzy matching, while preserving other installed versions and their metadata |
| Tests/MintTests/MintTests.swift | Adds test case to verify that uninstalling a specific version removes only that version while preserving others and their symlinks |
Comments suppressed due to low confidence (1)
Sources/MintKit/Mint.swift:676
- When removing a specific version, the code removes resource artifact links (bundles, dylibs, etc.) associated with that version without checking if remaining versions also use resources with the same name. If multiple versions share a resource file name, the symlink will be removed even though a remaining version still needs it. Consider checking if remaining versions contain resources with the same lastComponent before removing the links.
// remove resource artifact links related only to removed versions
for resource in resources {
let installPath = linkPath + resource.lastComponent
try installPath.delete()
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
Sources/MintKit/Mint.swift:684
- When uninstalling a specific version while other versions remain, this code removes resource links that may still be needed by the remaining versions. Each version has its own copy of resources (bundles, dylibs, etc.) in its install path, and the linked version's resources should remain symlinked in the linkPath. Consider checking if any remaining versions have executables that are linked before removing the resource links, or re-link resources from a remaining version after cleanup.
// remove resource artifact links related only to removed versions
for resource in resources {
let installPath = linkPath + resource.lastComponent
try installPath.delete()
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…s when no remaining installed version still references the same artifact
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use uppercase -V for --version to avoid confusion with -v (--verbose) used in other Mint commands like install, run, and bootstrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
It's was a long battle but we finally came in an agreement hehehe |
You can now uninstall a single installed version instead of always nuking all versions and there’s a new -v/--version flag.
Implemented as requested #206