1
0
chezmoi/home/.chezmoiscripts/run_onchange_after_11-install-asdf-plugins.sh.tmpl
2024-03-03 15:09:10 +01:00

47 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# Load asdf
. "$HOME/.asdf/asdf.sh"
# Logging function
log() {
printf "$(tput setaf 4)$(tput bold)>>>>> %s <<<<<$(tput sgr0)\n" "$1"
}
inf() {
printf "╚═══ᐳ $(tput sgr 0 1)$(tput setaf 2)%s$(tput sgr0)\n" "$1"
}
# Plugins to install
declare -A plugins
plugins=(
['golang']='https://github.com/asdf-community/asdf-golang.git'
['nodejs']='https://github.com/asdf-vm/asdf-nodejs.git'
['opam']='https://github.com/asdf-community/asdf-opam.git'
['ruby']='https://github.com/asdf-vm/asdf-ruby.git'
['rust']='https://github.com/code-lever/asdf-rust.git'
)
### Install ASDF plugins ###
log "Begin ASDF plugins installation"
inf "installing direnv with system version..."
# no need to run asdf direnv setup --shell zsh --version latest
# as it is managed by zim module
asdf plugin-add direnv
for plugin in ${!plugins[@]}; do
inf "installing ${plugin}..."
asdf plugin add ${plugin} ${plugins[$plugin]}
asdf install ${plugin} latest
asdf global ${plugin} latest
done
log "Finish ASDF plugins installation"