Expand description
§Purger
A tool for cleaning Rust project build directories.
This crate provides both command-line and GUI interfaces for scanning and cleaning Rust project target directories to free up disk space.
§Features
- Scan directories for Rust projects
- Clean target directories using
cargo clean
or direct deletion - Progress tracking for cleaning operations
- Both CLI and GUI interfaces
§Usage
§Command Line
# Scan current directory
purger scan
# Clean all projects in current directory
purger clean --all
# Dry run to see what would be cleaned
purger clean --dry-run
§As a Library
use purger_core::{ProjectScanner, ProjectCleaner, scanner::ScanConfig, cleaner::CleanConfig};
use std::path::Path;
// Scan for projects
let scanner = ProjectScanner::new(ScanConfig::default());
let projects = scanner.scan(Path::new("."))?;
// Clean projects (using dry_run to avoid actual deletion)
let mut clean_config = CleanConfig::default();
clean_config.dry_run = true; // Use dry run to avoid permission issues
let cleaner = ProjectCleaner::new(clean_config);
for project in &projects {
let _ = cleaner.clean_project(project); // Ignore result in doc test
}
Modules§
Structs§
- Clean
Config - 清理器配置
- Clean
Progress - 清理进度信息
- Clean
Result - 清理结果统计
- Project
Cleaner - 项目清理器
- Project
Filter - 项目过滤器
- Project
Scanner - Rust项目扫描器
- Rust
Project - Rust项目信息
- Scan
Config - 项目扫描器配置
Enums§
- Clean
Phase - 清理阶段
- Clean
Strategy - 清理策略
Functions§
- format_
bytes - 格式化字节大小为人类可读格式