-
Notifications
You must be signed in to change notification settings - Fork 23
Feature: sdk clean subcommand #397
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
- I have read the CONTRIBUTING guidelines
- I've had a conversation on our community Discord server.
Feature request
Implement a sdk clean subcommand that removes installed SDK versions no longer referenced by any .sdkmanrc file — i.e., orphaned versions that have accumulated over time.
This is analogous to brew autoremove for SDKMAN! candidates: it identifies versions that are installed but not pinned by any project configuration, and removes them to recover disk space.
Proposed behaviour
- Scan all
.sdkmanrcfiles found under a configurable base directory (e.g.~/) - Collect the union of all candidate versions referenced
- Compare against all currently installed versions
- Prompt the user to confirm removal of any installed versions not referenced by any
.sdkmanrc - Optionally support a
--dry-runflag to list what would be removed without acting - Always protect the current
defaultversion of each candidate, even if it is not referenced by any.sdkmanrcfile — so if.sdkmanrcpinsjava=21.0.10-temand the default is17.0.18-tem, both are kept; only versions that are neither referenced nor the default are candidates for removal
Note: this is intentionally separate from sdk flush, which handles temporary files and caches under $SDKMAN_DIR/tmp and $SDKMAN_DIR/var. sdk clean operates on installed candidate versions only.
Originally requested in sdkman/sdkman-cli#688.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request