Skip to content

feat: add native flush, config, and cache commands#440

Closed
youngledo wants to merge 1 commit into
sdkman:masterfrom
youngledo:feat/phase1-flush-config-cache
Closed

feat: add native flush, config, and cache commands#440
youngledo wants to merge 1 commit into
sdkman:masterfrom
youngledo:feat/phase1-flush-config-cache

Conversation

@youngledo
Copy link
Copy Markdown

Summary

Migrate three pure-filesystem Bash commands to Rust as Phase 1 of the complete Bash-to-Rust migration proposed in #439.

  • flush: Remove and recreate tmp, var/metadata, and var/version directories with disk usage reporting. Supports qualifiers: tmp, metadata, version, or flush all by default.
  • config: Open $SDKMAN_DIR/etc/config in the user's $EDITOR (defaults to vi). Supports editors with arguments (e.g., EDITOR="code --wait").
  • cache: Validate that the candidates cache file at $SDKMAN_DIR/var/candidates exists and is non-empty. Displays a warning with remediation instructions if corrupt.

Context

This is the first deliverable from the RFC in #439. These three commands were chosen because:

  1. They perform only local filesystem operations (no network, no shell env mutation)
  2. They follow the exact same pattern as the existing 6 migrated commands
  3. No architectural changes are required

Test plan

  • cargo test — all 58 tests pass (11 new + 47 existing), zero regressions
  • cargo clippy — zero new warnings on the three new binaries
  • flush: 5 tests covering default flush, tmp-only, metadata-only, version, and empty directory
  • config: 2 tests covering missing editor and successful editor launch
  • cache: 4 tests covering valid cache, empty cache, missing cache, and whitespace-only cache

Refs: #439

Migrate three pure-filesystem Bash commands to Rust as part of the
ongoing Bash-to-Rust migration (Phase 1):

- flush: remove and recreate tmp, metadata, version directories with
  disk usage reporting
- config: open $SDKMAN_DIR/etc/config in the user's $EDITOR (defaults
  to vi)
- cache: validate that the candidates cache file exists and is non-empty

These commands follow the existing binary pattern with no architectural
changes required.

Refs: sdkman#439
@marc0der marc0der closed this May 13, 2026
@chloe41427
Copy link
Copy Markdown
Contributor

chloe41427 Bot commented May 13, 2026

Thanks for the PR! We appreciate the effort, but we do have contributor guidelines that we'd like all contributors to follow before opening PRs.

On the technical side: we already have a roadmap to migrate all the Bash commands to Rust, but this is sequenced after the backend work (sdkman-state migration) is complete. Once that's stable, we'll migrate the remaining subcommands in a coordinated way.

Please reach out in our Discord community if you'd like to discuss the migration roadmap or how you can help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants