Files
vim-lsp-settings-mirror/installer/install-terraform-ls.sh
Ihor Urazov 4492fd36e5 New url for terraform-ls downloads
terraform-ls doesn't publish binaries under github releases anymore. Update url to reference releases.hashicorp.com.
2023-02-22 02:24:39 +09:00

38 lines
781 B
Bash
Executable File

#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
arch=$(uname -m | tr "[:upper:]" "[:lower:]")
case $os in
darwin | linux) ;;
*)
printf "%s is not supported" "$os"
exit 1
;;
esac
case $arch in
x86_64*) arch=amd64 ;;
386*) arch=386 ;;
arm64*) arch=arm64 ;;
aarch64*) arch=arm64 ;;
*)
printf "%s is not supported" "$arch"
exit 1
;;
esac
version=$(basename "$(curl -Ls -o /dev/null -w %\{url_effective\} https://github.com/hashicorp/terraform-ls/releases/latest)")
short_version=$(echo "$version" | cut -c2-)
filename="terraform-ls_${short_version}"
url="https://releases.hashicorp.com/terraform-ls/${short_version}/${filename}_${os}_${arch}.zip"
filename="${filename}.zip"
curl -L --progress-bar "$url" -o "$filename"
unzip "$filename"
rm "$filename"