Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwcastillo/4cbf6743be16acbe6e5e5bcea57b17c0 to your computer and use it in GitHub Desktop.
Save jwcastillo/4cbf6743be16acbe6e5e5bcea57b17c0 to your computer and use it in GitHub Desktop.
Update all asdf plugins to latest
#!/usr/bin/env bash
function log () {
printf "%s %s\n" "->" "$1"
}
log "Updating all asdf-plugin remotes..."
asdf plugin update --all
log "Updating each plugin reference to the latest revision..."
# TODO: Maybe refactor this shit, ew.
cat ~/.tool-versions \
| awk '{print $1}' \
| xargs -I {} bash -c 'echo {} $(asdf latest {})' > ~/.tool-versions.new; \
cp ~/.tool-versions ~/.tool-versions.bk; \
mv ~/.tool-versions.new ~/.tool-versions
log "Old revision versions:"
cat ~/.tool-versions.bk
log "New revision versions:"
cat ~/.tool-versions
while true; do
read -p "Do you wish to install all new revisions?" yn
case $yn in
[Yy]* ) asdf install; break;;
[Nn]* ) exit;;
* ) log "Please answer Yes or No.";;
esac
done
log "Done, bye! 👋"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment