fix(asdf_install): don't crash when no plugins are installed.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
James Harton 2023-07-20 10:46:46 +12:00
parent 65999fcf08
commit 48704e1951
Signed by: james
GPG key ID: 90E82DAA13F624F4

View file

@ -1,14 +1,13 @@
#!/bin/bash
set -e
set -v
source ~/.asdf/asdf.sh
REQUIRED_PLUGINS=$(cat .tool-versions | cut -d \ -f 1)
INSTALLED_PLUGINS=$(asdf plugin list)
INSTALLED_PLUGINS=$(asdf plugin list || echo "")
for PLUGIN in $REQUIRED_PLUGINS; do
if [[ $INSTALLED_PLUGINS =~ (^|[^[:alpha:]])$PLUGIN([^[:alpha:]]|$) ]]; then
if [[ $INSTALLED_PLUGINS =~ (^|[[:space:]])"$PLUGIN"($|[[:space:]]) ]]; then
echo "ASDF plugin $PLUGIN already installed"
else
echo "Installing $PLUGIN ASDF plugin..."