Skip to content

Commit

Permalink
refactor: Ensure asdf shows right runtime version
Browse files Browse the repository at this point in the history
Workaround for the bug described here: asdf-vm/asdf#1180
  • Loading branch information
mbd-s committed May 6, 2023
1 parent fb12217 commit 1d6b9a8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions fish/functions/asdf_plugin_update.fish
@@ -1,13 +1,15 @@
function asdf_plugin_update -d "Update outdated asdf plugins"
echo $BOLD"Updating outdated asdf plugins"$RESET_COLOR
asdf plugin-update --all
set -l plugins (asdf latest --all)
asdf plugin-update --all > /dev/null
set -l plugins (asdf plugin list)
for plugin in $plugins
switch $plugin
case "*missing"
set -l missing_plugin (string match -r '[a-z]+' $plugin)
echo $BOLD"Installing latest version of $missing_plugin"$RESET_COLOR
asdf install $missing_plugin latest
set -l latest_version (asdf latest $plugin)
set -l installed_versions (string match -r '[0-9.]+' (asdf list $plugin))
if contains $latest_version $installed_versions
echo $GREEN"$plugin $latest_version is already installed"$RESET_COLOR
else
echo $BOLD"Installing $plugin $latest_version"$RESET_COLOR
asdf install $plugin latest
end
end
end

0 comments on commit 1d6b9a8

Please sign in to comment.