Skip to content

Instantly share code, notes, and snippets.

@ig0rsky
Last active April 22, 2024 02:06
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ig0rsky/fef7f785b940d13b52eb1b379bd7438d to your computer and use it in GitHub Desktop.
Save ig0rsky/fef7f785b940d13b52eb1b379bd7438d 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