-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo clean --recursive #11305
Comments
At the moment, cargo has no multi-workspace support, so this would be a first. As such, the flag would need to make that clear and I don't think "recursive" would do that. This also requires cargo correctly identifying all of the target directories that it recurses into. Personally, I wonder if #11156 would be a better way for making it easy to clean up everything. |
That makes it easier to clean up everything, but on the flip side |
#11156 only makes it so all the target dirs are in the same directory, they are still distinct from each other. |
I think --recursive would fit pretty well since nealy all gnu like cli tools use it as well. And maybe it makes sense to implement --recursive into cargo globally. Then the usage would look like this:
It would search in the current directory and then run the command on all the project founds. If no command specified, it would display all project found. EDIT:I would also add
An alternative would be a cargo-recursive like cargo find (as reference to gnu find)
or
this might be the easier and less breaking way compared to moving target |
@epage what do you think about handling it this way? Instead of --recursive we could also use --find that takes an optional path, defaulting to the current dir. Finding projects would be as easy as running WalkDir on the folder and filtering out all files named Cargo.toml |
I would also make a similar option named --members that apply the subcommand to all members of the current crate Otherwise actions that are shared between members,like clean, would be executed on every single crate, even though it only needs to be executed once. Also --members would be pretty useful to e.g. add dependencies to all members or running cargo tarpulin on all of them. |
One option is to develop |
https://lib.rs/crates/cargo-recursive exists, but it doesn't look very popular. Maybe it makes sense to just make something that works for cleaning for now. |
Problem
Many have a folder with their cargo projects that quickly becomes very big (10 GB+)
Currently users need to go into each project indiviually and run
cargo clean
to clear storage or use a script or tool that does it for them.Proposed Solution
A recursive option for the clean subcommand would provide an easy native way to clean folders.
It should scan for projects in the current directory and then run the clean function on each of them.
Notes
No response
The text was updated successfully, but these errors were encountered: