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

stack-clean-old purge-older may say nothing #6

Open
andreasabel opened this issue Sep 24, 2021 · 9 comments
Open

stack-clean-old purge-older may say nothing #6

andreasabel opened this issue Sep 24, 2021 · 9 comments

Comments

@andreasabel
Copy link

I am getting

$ stack-clean-old purge-older --dry-run
$

Would be nice if I was told explicitly that there is nothing to purge, or a list of what would be purged.

Btw, I wrote something similar (but less feature-rich) for cabal, see https://github.com/andreasabel/cabal-clean.

I made --dry-run is the default. If you call it without arguments, you get a list of all build artefacts that are there, in green color those that will be kept, in red color those that would be deleted. To remove stuff, you have to supply option --remove/--delete.

Maybe such an interface would also work for stack-clean-old.

@juhp
Copy link
Owner

juhp commented Sep 24, 2021

Thanks for this, Andreas: that does sound like a nice approach.
Perhaps I can adapt that for the next version.
I think you are right too: a message saying nothing to do wouldn't hurt.
I should take a look at cabal-clean too.

@andreasabel
Copy link
Author

I now realize cabal-clean could also drop a final sentence what it did (nothing, or how many directories were removed).

@juhp
Copy link
Owner

juhp commented Sep 25, 2021

I have implemented --delete locally now, but with the (poor) way purge-older is implemented currently it is slightly difficult to avoid no output when there is nothing to remove since it looks at each ghc major version in turn.

juhp added a commit that referenced this issue Sep 26, 2021
- bump version to 0.4
- replace Bool with Deletion type
@juhp
Copy link
Owner

juhp commented Sep 26, 2021

I pushed my changes - if you want to test it before I make a release that would be helpful too.
Either way I will probably release 0.4 by tomorrow anyway - thanks again for the useful suggestions.

@juhp
Copy link
Owner

juhp commented Sep 27, 2021

I tried your cabal-clean: certainly seems clean and simple. 👍

@juhp
Copy link
Owner

juhp commented Oct 2, 2021

(Also 0.4 was finally released.)

I will leave this open for now so I can try to revisit it at some point.

@andreasabel
Copy link
Author

I played around with 0.4 a bit. It is nice that --delete is now required to actually remove stuff!
The help screen could say this upfront, e.g.

$ stack-clean-old 
Stack clean up tool

Usage: stack-clean-old [--version] COMMAND
  Cleans away old stack-work builds (and pending: stack snapshots) to recover
  diskspace.

Available options:
  -h,--help                Show this help text
  --version                Show version

Available commands:
  size                     Total size
  list                     List sizes per ghc version
  remove                   Remove for a ghc version
  keep-minor               Remove for previous ghc minor versions
  purge-older              Purge older builds in .stack-work/install
  delete-work              Remove project's .stack-work subdirs recursively

No files will be deleted unless option --delete (short: -d) is given.

The OP is still open, but you already stated that this is future work.

@juhp
Copy link
Owner

juhp commented Oct 5, 2021

Ah that is a good point! I will probably add an link to the readme too.

@juhp
Copy link
Owner

juhp commented Oct 5, 2021

Okay I released 0.4.1 to hackage with that.

@juhp juhp changed the title stack-clean-old purge-older --dry-run may say nothing stack-clean-old purge-older may say nothing Nov 22, 2021
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

No branches or pull requests

2 participants