From b95243b2fdd960f0959d6afba6e16cae4b22c96b Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 11 Feb 2025 18:55:50 +0900 Subject: [PATCH] Simplify template version replace in read_download_info --- main.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.sh b/main.sh index da2a7596..e37af1cf 100755 --- a/main.sh +++ b/main.sh @@ -277,13 +277,13 @@ read_download_info() { bin_in_archive=() if [[ "${url}" == "null" ]]; then local template - template=$(jq -r ".template.${host_platform}" "${manifest_dir}/${tool}.json") + template=$(jq -c ".template.${host_platform}" "${manifest_dir}/${tool}.json") + template="${template//\$\{version\}/${exact_version}}" url=$(jq -r '.url' <<<"${template}") - url="${url//\$\{version\}/${exact_version}}" - tmp=$(jq -r '.bin' <<<"${template}" | sed -E "s/\\$\\{version\\}/${exact_version}/g") + tmp=$(jq -r '.bin' <<<"${template}") if [[ "${tmp}" == *"["* ]]; then # shellcheck disable=SC2207 - bin_in_archive=($(jq -r '.bin[]' <<<"${template}" | sed -E "s/\\$\\{version\\}/${exact_version}/g")) + bin_in_archive=($(jq -r '.bin[]' <<<"${template}")) fi else tmp=$(jq -r '.bin' <<<"${download_info}")