Documentation
¶
Overview ¶
Package toolclean discovers developer tools present on the machine and runs each tool's own cache-cleanup command (e.g. `uv cache prune`, `pnpm store prune`, `cargo clean`). Letting a tool prune itself is safer than `rm -rf`: it removes only what it can rebuild and keeps the tool's bookkeeping consistent. This mirrors the show_tool_cleanups step of the reference script.
It also discovers Rust project build directories under common project roots (overridable via CLEANX_PROJECT_DIRS) and offers a per-project `cargo clean`, since target/ dirs are routinely the largest reclaimable space on a dev box.
Command execution and sizing are injected (CmdRunner / SizeFunc) so discovery, selection, and freed-space accounting are unit-tested without touching the system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProjectRoots ¶
ProjectRoots returns the directories searched for Rust build dirs. It honours a colon-separated CLEANX_PROJECT_DIRS override; otherwise it probes common conventions (non-existent ones are skipped during discovery).
Types ¶
type Cleanup ¶
type Cleanup struct {
Label string
Name string // command binary
Args []string // command arguments
SizeDir string // directory measured for size + freed accounting ("" if none)
SizeKB int64 // current size of SizeDir, filled by Available
}
Cleanup is one offered tool cleanup: a label, the command to run, and the directory whose size is measured before/after to report space reclaimed.
func Available ¶
Available returns the tool cleanups whose binaries exist, each sized via sizeKB, plus per-project `cargo clean` entries discovered under the project roots (only when the cargo binary is present).
func (Cleanup) Command ¶
Command returns the human-readable command string shown to the user before they select a cleanup (e.g. "brew cleanup -s --prune=all").