Last active
October 3, 2024 11:24
-
-
Save ig0rsky/fef7f785b940d13b52eb1b379bd7438d to your computer and use it in GitHub Desktop.
Update all asdf plugins to latest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
Isn't what
asdf plugin update --all
is suppose to do?