Skip to content

Commit

Permalink
Add ghcup_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Jul 3, 2024
1 parent a8f866b commit 12bfeb1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ ensure_ghcup() {
fi
}

ghcup_wrapper() {
GHCUP_INSTALL_BASE_PREFIX="$(asdf_plugin_path)" "$(ghcup_bin_dir)/ghcup" "@"
}

list_all_versions() {
ensure_ghcup
GHCUP_INSTALL_BASE_PREFIX="$(asdf_plugin_path)" "$(ghcup_bin_dir)/ghcup" list -t "$1" -r | awk '{printf $2" "}'
ghcup_wrapper list -t "$1" -r | awk '{printf $2" "}'
}

ver() {
Expand All @@ -35,8 +39,8 @@ install_version() {
ensure_ghcup

if [[ $tool == "ghc" ]] || { [[ $tool == "hls" ]] && [[ $(ver "$version") -ge $(ver "1.7") ]]; }; then
GHCUP_INSTALL_BASE_PREFIX="$(asdf_plugin_path)" "$(ghcup_bin_dir)/ghcup" install "$tool" "$version" -i "$path"
ghcup_wrapper install "$tool" "$version" -i "$path"
else
GHCUP_INSTALL_BASE_PREFIX="$(asdf_plugin_path)" "$(ghcup_bin_dir)/ghcup" install "$tool" "$version" -i "${path}/bin"
ghcup_wrapper install "$tool" "$version" -i "${path}/bin"
fi
}

0 comments on commit 12bfeb1

Please sign in to comment.