96 lines
1.8 KiB
Markdown
96 lines
1.8 KiB
Markdown
# cargo-cleanup
|
|
|
|
**A fast, recursive `cargo clean` tool for saving disk space across multiple Rust projects.**
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
`cargo-cleanup` is a Cargo subcommand that recursively cleans build artifacts from Rust projects, helping you reclaim disk space. Instead of running `cargo clean` in each project manually, you can clean entire directory trees in a single command.
|
|
|
|
---
|
|
|
|
## Features
|
|
|
|
- **Recursive cleaning**: Clean build artifacts across all Cargo projects in a directory tree
|
|
- **Dry-run mode**: Preview what would be deleted without actually removing files
|
|
- **Simple CLI**: Intuitive subcommand interface integrated with Cargo
|
|
- **Multi-path support**: Clean multiple directories in one command
|
|
|
|
---
|
|
|
|
## Installation
|
|
|
|
Add this to your `Cargo.toml`:
|
|
|
|
```toml
|
|
[dependencies]
|
|
# or install with: cargo install cargo-cleanup
|
|
```
|
|
|
|
Or install directly from source:
|
|
|
|
```bash
|
|
cargo install --path .
|
|
```
|
|
|
|
---
|
|
|
|
## Usage
|
|
|
|
### Basic usage
|
|
|
|
Clean the current directory and all subdirectories:
|
|
|
|
```bash
|
|
cargo slim
|
|
```
|
|
|
|
### Clean specific directories
|
|
|
|
```bash
|
|
cargo slim path/to/project1 path/to/project2
|
|
```
|
|
|
|
### Preview changes with dry-run
|
|
|
|
```bash
|
|
cargo slim --dry-run
|
|
```
|
|
|
|
### Get help
|
|
|
|
```bash
|
|
cargo slim --help
|
|
```
|
|
|
|
---
|
|
|
|
## How it works
|
|
|
|
`cargo-cleanup` recursively searches for `Cargo.toml` files in the specified paths (or current directory by default) and runs `cargo clean` in each project found. This removes `target/` directories and other build artifacts, freeing up disk space.
|
|
|
|
---
|
|
|
|
## Examples
|
|
|
|
```bash
|
|
# Clean current project and any nested workspaces
|
|
cargo slim
|
|
|
|
# Clean your entire ~/projects directory
|
|
cargo slim ~/projects
|
|
|
|
# See what would be deleted without actually deleting
|
|
cargo slim ~/projects --dry-run
|
|
|
|
# Clean multiple locations at once
|
|
cargo slim ~/work ~/hobby-projects
|
|
```
|
|
|
|
---
|
|
|
|
## License
|
|
|
|
MIT
|