holmgr / cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo
MIT License
690 stars 31 forks source link

Tweak message for when nothing is cleaned from a project #93

Closed marcospb19 closed 2 months ago

marcospb19 commented 1 year ago

I think it would be a good small improvement if cargo-sweep emitted a different message for when it cleans 0.00 bytes from a project.

After running this at my $HOME:

$ cargo sweep -t 100 -r

I got this:

[INFO] Cleaned 0.00 bytes from "/home/marcospb19/cargo-sweep/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/code/rust/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/client/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/file-backed-queue/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/gui/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/proto/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/recording-datatypes/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/scoring/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/server/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ds/server-store/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/languages/cacau/target"
[INFO] Cleaned 70.13 KiB from "/home/marcospb19/languages/cocoa/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/languages/dada/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/languages/lalrpop/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/languages/lox/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/languages/rustfmt/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/languages/sushi/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ouch/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/ouch/target/package/ouch-0.4.0/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/rust-skeleton-hexagonal/target"
[INFO] Cleaned 23.63 KiB from "/home/marcospb19/stuff/dotao/target"
[INFO] Cleaned 23.88 KiB from "/home/marcospb19/stuff/fs-tree/target"
[INFO] Cleaned 6.48 GiB from "/home/marcospb19/stuff/keyrocky/target"
[INFO] Cleaned 0.00 bytes from "/home/marcospb19/stuff/reflect/target"
[INFO] Cleaned 3.04 KiB from "/home/marcospb19/stuff/wsid/target"

A lot of lines look like this:

[INFO] Cleaned 0.00 bytes from "/home/marcospb19/cargo-sweep/target"

Instead of "Cleaned 0.00 bytes from", it could tell something like "Did nothing on", "Cleaned nothing from" or "Nothing to do at".

jyn514 commented 1 year ago

Hmm, maybe instead we should lower the log level to DEBUG if nothing was cleaned?

marcospb19 commented 1 year ago

That would be bad if you're not using --recursive.

# Please sweep on current directory
$ cargo sweep --installed

I'd expect some output to be shown with some message, if nothing is outputted, I can assume it worked and sweeped the project.

Also, it's very useful to see what --recursive detected and tried to clean.

Expurple commented 2 months ago

I think, this can be closed now

marcospb19 commented 2 months ago

True! Thanks.

GitHub tip: you can add "Fixes #NNN" or "Fix #NNN" to automatically close the referred issue with the PR merge :wink:.

Expurple commented 2 months ago

Yeah, I actually included "#NNN" in the commit message, but looks like it either requires "Fix" / "Fixes" or only works in pull requests