How pwnxpl0it/cargo-scrub works
cargo-scrub is a Rust CLI for discovering Rust crates and optionally removing their build artifacts. The main workflow walks a directory tree, identifies crates and workspaces, filters and selects candidates, runs parallel cargo clean jobs (or records a dry run), then reports results. Users can instead review and clean selections in a full-screen TUI. The graph preserves configuration, logging, and output layers; links involving unsampled CLI/configuration wiring are omitted where evidence does not establish calls.
Main entry points: engine.rs Scrub engine · mod.rs TUI event loop · main.rs Program entry · cleaner.rs Crate cleaner
Components 17
Command interface
- Program entry
src/main.rs - CLI options
src/cli.rs
Crate discovery
- Directory walker
src/walker.rs - Crate and workspace detection
src/detector.rs - Crate filters
src/filter.rs
Cleaning and reports
- Scrub engine
src/engine.rs - Crate cleaner
src/cleaner.rs - Summary reporting
src/report.rs
Interactive dashboard
- TUI event loop
src/tui/mod.rs - Dashboard state
src/tui/app.rs - Key mapping
src/tui/events.rs - Dashboard rendering
src/tui/ui.rs
Configuration and logging
- Persistent options
src/config.rs - Log levels
src/loglevel.rs - Logging
src/logging.rs
Other components
- Operator
- Cargo clean command
Connections 15
- Operator → Program entry: runs
README.md - Program entry → CLI options: uses options
src/main.rs - Program entry → TUI event loop: launches
src/main.rs - Scrub engine → Directory walker: walks directories
src/engine.rs - Scrub engine → Crate and workspace detection: checks workspaces
src/engine.rs - Scrub engine → Crate filters: filters crates
src/engine.rs - Scrub engine → Crate cleaner: cleans crates
src/engine.rs - Crate cleaner → Cargo clean command: runs
src/cleaner.rs - Scrub engine → Summary reporting: builds report
src/engine.rs - Persistent options → Log levels: uses level
src/config.rs - TUI event loop → Scrub engine: discovers and cleans
src/tui/mod.rs - TUI event loop → Dashboard state: updates state
src/tui/mod.rs - TUI event loop → Key mapping: maps keys
src/tui/mod.rs - TUI event loop → Dashboard rendering: draws screens
src/tui/mod.rs - Dashboard rendering → Dashboard state: renders state
src/tui/ui.rs