Skip to content

Commit 519b797

Browse files
committed
fix jetbrains shellcheck warnings
1 parent e59bc1b commit 519b797

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

bin/jbr.bash

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ ensure_directory "${CHECKSUM_DIR}"
2323

2424

2525
function download {
26-
local tag_name="${1}"
27-
local asset_name="${2}"
28-
local url="${3}"
29-
local release_type="${4}"
30-
local description="${5}"
26+
local asset_name="${1}"
27+
local url="${2}"
28+
local release_type="${3}"
29+
local description="${4}"
3130
local filename="${asset_name}"
3231

3332
local metadata_file="${METADATA_DIR}/${filename}.json"
@@ -42,6 +41,7 @@ function download {
4241
then
4342
download_file "${url}" "${archive}" || return 1
4443

44+
# shellcheck disable=SC2016
4545
local regex='s/^jbr(sdk)?(?:_\w+)?-([0-9\+.]{1,})-(linux-musl|linux|osx|macos|windows)-(aarch64|x64|x86)(?:-\w+)?-(b[0-9\+.]{1,})(?:_\w+)?\.(tar\.gz|zip|pkg)$/ARCH="$4" OS="$3" VERSION="$2$5" JAVA_VERSION="$3" IMAGE_TYPE="$1" EXT="$6"/g'
4646

4747
local VERSION=""
@@ -125,7 +125,7 @@ download_github_releases 'JetBrains' 'JetBrainsRuntime' "${RELEASE_FILE}"
125125
versions=$(jq -r '.[].tag_name' "${RELEASE_FILE}" | sort -V)
126126

127127
assets_json=${TEMP_DIR}/assets-parsed.json
128-
jq '[ .[] | ({version: .tag_name, type: (if .prerelease then "ea" else "ga" end) } + (.body | capture("\\|\\s*(?:\\*\\*)?(?<description>[^|]+?)(?:\\*\\*)?\\s*\\|\\s*\\[(?<file>[^\\]]+)\\]\\((?<url>https:[^\\)]+)\\)\\s*\\|\\s*\\[checksum\\]\\((?<checksum_url>https:[^\\)]+)\\)";"g")) ) ]' $RELEASE_FILE > "${assets_json}"
128+
jq '[ .[] | ({version: .tag_name, type: (if .prerelease then "ea" else "ga" end) } + (.body | capture("\\|\\s*(?:\\*\\*)?(?<description>[^|]+?)(?:\\*\\*)?\\s*\\|\\s*\\[(?<file>[^\\]]+)\\]\\((?<url>https:[^\\)]+)\\)\\s*\\|\\s*\\[checksum\\]\\((?<checksum_url>https:[^\\)]+)\\)";"g")) ) ]' "$RELEASE_FILE" > "${assets_json}"
129129

130130
for version in ${versions}
131131
do
@@ -136,7 +136,7 @@ do
136136
readarray -t descriptions < <(jq -r ".[] | select(.version == \"${version}\") | .description" "${assets_json}")
137137
for ((i = 0; i < ${#assets[@]}; i++));
138138
do
139-
download "${version}" "${assets[i]}" "${download_urls[i]}" "${release_types[i]}" "${descriptions[i]}" || echo "Cannot download ${asset}"
139+
download "${assets[i]}" "${download_urls[i]}" "${release_types[i]}" "${descriptions[i]}" || echo "Cannot download ${asset_name}"
140140
done
141141

142142
done

0 commit comments

Comments
 (0)