cargo-broomv0.1.0

CASOONOpen Source

Sweep cold Cargo targets, not your work.

cargo-broom finds the build output of every Rust project below a directory and removes what has gone cold. It refuses to delete without an explicit flag, and it never removes a shared, overridden or running target as a whole.

cargo install cargo-broom
cargo install --git https://github.com/casoon/broom
MITv0.1.0Cargo subcommandRust 1.89+
cargo broom --dry-run ~/code
cargo-broom Summary (Dry Run)
ℹ cargo-broom

  Reclaimable: 2.89 MiB

● Level A — Full Target Clean (Coarse) (2)
  - blog-engine (1.86 MiB) at ~/code/blog-engine/target
  - weather-api (1.03 MiB) at ~/code/weather-api/target

Next steps:
  • Run `cargo broom -y` to reclaim 2.89 MiB
    $ cargo broom -y
flags that allow a cleanup: --dry-run, --interactive, --yes
3
default age before a whole target qualifies
14 days
subcommands, four of them read-only
6
CI platforms: Linux, macOS, Windows
3

What it does

Generated at build time

All examples →
cargo broom inspect ~/code
cargo-broom Inspect — ~/code
Found 5 Rust target directories occupying 8.86 MiB

 • blog-engine                 1.86 MiB  ~/code/blog-engine/target
 • invoice-cli                 2.83 MiB  ~/code/invoice-cli/target
 • plugin-a (+1 more, shared target)   2.06 MiB  ~/code/plugins/shared-target [Target Override]
 • toolkit-core                1.07 MiB  ~/code/toolkit/target
 • weather-api                 1.03 MiB  ~/code/weather-api/target

Captured from cargo-broom 0.1.0 over five sample projects that examples/generate.sh builds in a temporary directory. Only the temporary path is shortened to ~/code.

examples/inspect.txt

Quickstart

Inspect, preview, then clean. The first two steps change nothing on disk.

  1. Install the crate; Cargo runs it as cargo broom.
  2. Run inspect and a --dry-run over the directory that holds your projects.
  3. When the selection is right, clean with --interactive or --yes.
terminalShell
# What is there? Read-only.
cargo broom inspect ~/code

# What would go? Deletes nothing.
cargo broom --dry-run --keep-days 30 --keep-size 50MB ~/code

# Clean up, recoverably
cargo broom --yes --trash --keep-days 30 --keep-size 50MB ~/code

Inspect first, clean second.

Read the quickstart