#tool #cli #cargo

app cargo-sweep

A tool for cleaning unused build files created by Cargo

6 releases (3 breaking)

✓ Uses Rust 2018 edition

0.4.1 Feb 5, 2019
0.4.0 Jan 23, 2019
0.3.0 Dec 7, 2018
0.2.0 Nov 12, 2018
0.1.1 Nov 9, 2018

#43 in Cargo plugins

Download history 25/week @ 2019-03-28 33/week @ 2019-04-04 93/week @ 2019-04-11 98/week @ 2019-04-18 14/week @ 2019-04-25 52/week @ 2019-05-02 105/week @ 2019-05-09 155/week @ 2019-05-16 122/week @ 2019-05-23 105/week @ 2019-05-30 125/week @ 2019-06-06 108/week @ 2019-06-13 80/week @ 2019-06-20 112/week @ 2019-06-27 127/week @ 2019-07-04

292 downloads per month

MIT license

34KB
767 lines

Cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo.

Motivation

Ideally you want:

  • Caching of recent artifacts for fast build times
  • Limited target size so that CI caches (on Travis etc.) are fast
  • An easy way of maintaining one or more projects at the same time

Cargo-sweep aims to solve all these issues for which a simple cargo clean is not sufficient.

Quick start

To install run:

cargo install cargo-sweep

To clean all build files older than 30 days in the local cargo project run:

cargo sweep -t 30

To clean all build files not made by the currently installed (by rustup) nightly compiler:

cargo sweep --toolchains="nightly"

This can be useful if you checked that your library works on stable, but mostly develop on nightly.

To clean all build files not made by any of the currently installed (by rustup) compilers:

cargo sweep -i

This can be useful if you just updated your compilers with a rustup update.

To preview the results of a sweep run, which is recommended as a first step, add the -d flag, for instance:

cargo sweep -d -t 30

You can also specify a path instead of defaulting to the current directory:

cargo sweep -t 30 <path>

To clean everything but the latest build you will need to run it in several steps.

cargo sweep -s

<Insert any number of cargo build, cargo test etc...>

cargo sweep -f

The first step generates a timestamp file which will be used to clean everything that was not used between it and the next time the file (-f) option is used.

Finally, you can recursively clean all cargo project below a given path by adding the -r flag, for instance:

cargo sweep -r -t 30 code/github.com/holmgr/

For more information run:

cargo sweep -h

License

Cargo-sweep is distributed under the terms the MIT license.

See LICENSE for details.

Dependencies

~4.5MB
~81K SLoC