asdf-vm/asdf

Introduce --keep-latest-version-only flag for install and/or uninstall command to cleanup previous versions

a-b opened this issue · 0 comments

a-b commented

Is your feature request related to a problem? Please describe

When I'm running something like

asdf latest --all \
| grep missing \
| grep -v -e node -e golang \
| awk '{print $1}' \
| xargs -n1 -P1 -I_ echo asdf install _ latest
#TODO: remove    ^^^ echo 

to check and install latest versions of plugins. Now I have to manually remove old versions.

Describe the proposed solution

I find it helpful to have an option to pass flag --keep-latest-version-only, to install and/or uninstall command so only the latest version stays, all previous versions get removed.

Describe similar asdf features and why they are not sufficient

It is possible to write a shell script to clean older versions, but it's bulky.

asdf latest --all \
| awk '{print $1}' \
| xargs -n1 -P1 -I_ bash -c "echo _:; asdf list _"
#TODO: add logic to remove old versions...

Describe other workarounds you've considered

  1. Do nothing and observe wasted disk space by older versions of packages I don't care about.
  2. Manually prune
  3. Write script to automate