Skip to content
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

Only delete old project (skip active project) #64

Closed
azzamsa opened this issue Sep 25, 2022 · 7 comments · Fixed by #66
Closed

Only delete old project (skip active project) #64

azzamsa opened this issue Sep 25, 2022 · 7 comments · Fixed by #66

Comments

@azzamsa
Copy link

azzamsa commented Sep 25, 2022

Hi.

When I use kondo in my directory project, it deletes all the build artifacts in all directories. Including the active one.
woubuc/sweep: Reduce the disk usage of your projects by removing dependencies & builds on the other hand, only delete inactive directory: old projects that haven't been changed in more than a month.

Sweep (swp) finds old projects that haven't been changed in more than a month.

I thought I was missing some options. But I don't find any clue with kondo --help.

@tbillington
Copy link
Owner

When I use kondo in my directory project, it deletes all the build artifacts in all directories. Including the active one.

Hey @azzamsa , just to be sure, kondo should only delete from projects that you choose to "clean", if it's deleting from projects without your express consent please file an issue for that!

In regards to "active" projects, it's hard to say what is active, that will depend on the user. I was actually working on a way to surface the projects last modified date yesterday. It's my hope that will provide the user enough information to base their decision.

As for automatically cleaning projects older than a certain date, I honestly hadn't thought of that, but it's something I may consider adding. Thank you for letting me know about that!

@azzamsa
Copy link
Author

azzamsa commented Sep 26, 2022

As for automatically cleaning projects older than a certain date, I honestly hadn't thought of that, but it's something I may consider adding. Thank you for letting me know about that!

Yes, I think it doesn't need to be configurable as args. last modified file > one month is enough to say the project is inactive.
Or we could create a poll in discussion what will be the default (hardcoded): one month or one week.

@tbillington
Copy link
Owner

I've added a printout of the last date a file in the project was modified, which was the first step towards something like this

/Users/choc/code/sp-liveview Cargo project (2 days ago)
  └─ target (615.6MiB)
  delete above artifact directories? ([y]es, [n]o, [a]ll, [q]uit): n

/Users/choc/code/rust-au Cargo project (3 months ago)
  └─ target (2.2GiB)
  delete above artifact directories? ([y]es, [n]o, [a]ll, [q]uit): n

/Users/choc/code/rust-prod-api Cargo project (2 months ago)
  └─ target (1.7GiB)
  delete above artifact directories? ([y]es, [n]o, [a]ll, [q]uit): q

@tbillington
Copy link
Owner

What about some kind of minimal filter syntax for passing to kondo.

For example kondo projects-dir -f 1m which would only show projects modified more than 1 month ago. Then you could do things like kondo -f 2d or kondo -f 1y etc.

You could combine that with the --all or -a flag to automatically clean the matching projects.

@azzamsa
Copy link
Author

azzamsa commented Oct 2, 2022

You could combine that with the --all or -a flag to automatically clean the matching projects.

I think it should be the default, to avoid breaking current workflow.

@azzamsa
Copy link
Author

azzamsa commented Dec 5, 2022

@tbillington I think we need a new release that includes #66 :)

@tbillington
Copy link
Owner

Yep good call, thank you for the reminder @azzamsa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants