Skip to content

Commit ea59749

Browse files
Updates for latest versions of asdf (#655)
* Update asdf if it is already installed. * Update asdf commands to work with latest versions.
1 parent 0c68380 commit ea59749

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
## 2025-06-25
10+
11+
* asdf is now updated if it is already installed and asdf commands were updated
12+
to work with latest versions.
13+
914
## 2024-09-24
1015

1116
* Support for macOS Sequoia

mac

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,19 @@ fancy_echo "Configuring asdf version manager ..."
168168
if [ ! -d "$HOME/.asdf" ]; then
169169
brew install asdf
170170
append_to_zshrc "source $(brew --prefix asdf)/libexec/asdf.sh" 1
171+
else
172+
brew upgrade asdf
171173
fi
172174

173175
alias install_asdf_plugin=add_or_update_asdf_plugin
174176
add_or_update_asdf_plugin() {
175177
local name="$1"
176178
local url="$2"
177179

178-
if ! asdf plugin-list | grep -Fq "$name"; then
179-
asdf plugin-add "$name" "$url"
180+
if ! asdf plugin list | grep -Fq "$name"; then
181+
asdf plugin add "$name" "$url"
180182
else
181-
asdf plugin-update "$name"
183+
asdf plugin update "$name"
182184
fi
183185
}
184186

@@ -190,11 +192,11 @@ add_or_update_asdf_plugin "nodejs" "https://github.com/asdf-vm/asdf-nodejs.git"
190192
install_asdf_language() {
191193
local language="$1"
192194
local version
193-
version="$(asdf list-all "$language" | grep -v "[a-z]" | tail -1)"
195+
version="$(asdf list all "$language" | grep -v "[a-z]" | tr -s '\n' | tail -1)"
194196

195197
if ! asdf list "$language" | grep -Fq "$version"; then
196198
asdf install "$language" "$version"
197-
asdf global "$language" "$version"
199+
asdf set --home "$language" "$version"
198200
fi
199201
}
200202

0 commit comments

Comments
 (0)