Use compatible awk expression

Undo the awk expression change introduced in PR537. The third argument
is not supported by the non-GNU awk installed on MacOS by default.

Fixes issue 540
This commit is contained in:
Robert Williams
2022-02-21 14:54:09 +00:00
committed by mattn
parent b72e714b07
commit 4b6c251930

View File

@@ -24,11 +24,8 @@ arm64*) arch=arm64 ;;
;;
esac
version=$(
curl --location --silent "https://api.github.com/repos/hashicorp/terraform-ls/releases/latest" |
awk 'match($0, /"tag_name": "(.+)"/, a) { print a[1] }'
)
short_version=$(echo "${version}" | awk 'match($0, /v(.+)/, a) { print a[1] }')
version=$(basename $(curl -Ls -o /dev/null -w %\{url_effective\} https://github.com/hashicorp/terraform-ls/releases/latest))
short_version=$(echo "$version" | awk '{print substr($0, 2)}')
filename="terraform-ls_${short_version}"
url="https://github.com/hashicorp/terraform-ls/releases/download/${version}/${filename}_${os}_${arch}.zip"
filename="${filename}.zip"