add asdf-update script
This commit is contained in:
parent
b71ad5ae13
commit
cadc67571a
@ -6,3 +6,4 @@ source $(dirname "$0")/functions/y.zsh;
|
|||||||
source $(dirname "$0")/functions/fp.zsh;
|
source $(dirname "$0")/functions/fp.zsh;
|
||||||
source $(dirname "$0")/functions/mke.zsh;
|
source $(dirname "$0")/functions/mke.zsh;
|
||||||
source $(dirname "$0")/functions/rn.zsh;
|
source $(dirname "$0")/functions/rn.zsh;
|
||||||
|
source $(dirname "$0")/functions/asdf-update.zsh;
|
36
configs/zsh/functions/asdf-update.zsh
Normal file
36
configs/zsh/functions/asdf-update.zsh
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
function asdf-update(){
|
||||||
|
|
||||||
|
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 yn"?Do you wish to install all new revisions?"
|
||||||
|
case $yn in
|
||||||
|
[Yy]* ) asdf install; break;;
|
||||||
|
[Nn]* ) exit;;
|
||||||
|
* ) log "Please answer Yes or No.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
log "Done, bye! 👋"
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user