1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-01-06 21:49:40 +02:00

fetch-archives: Fix various ShellCheck issues

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-06-01 10:47:38 +02:00
parent d800846365
commit 8f60f64617

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Nerd Fonts Version: 3.0.1
# Script Version: 2.0.0
# Script Version: 2.0.1
#
# Fetches the current release files.
# It fetches the latest release, not release candidate.
@ -31,18 +31,24 @@ fi
if [ "${versiontag}" != "latest" ]; then
echo "${LINE_PREFIX} Fetching release archives with version tag '${versiontag}'"
releasedata=$(curl -Lf "https://api.github.com/repos/ryanoasis/nerd-fonts/releases")
num=$(jq ".[] | select(.tag_name == \"${versiontag}\") | .assets | length" <<< ${releasedata})
num=$(jq ".[] | select(.tag_name == \"${versiontag}\") | .assets | length" <<< "${releasedata}")
if [ -z "${num}" ]; then
echo "${LINE_PREFIX} Release tag ${versiontag} unknown"
exit 1
fi
files=($(jq -r ".[] | select(.tag_name == \"${versiontag}\") | .assets[].name | @sh" <<< ${releasedata}))
files=()
while IFS='' read -r file; do
files+=("$file")
done < <(jq -r ".[] | select(.tag_name == \"${versiontag}\") | .assets[].name | @sh" <<< "${releasedata}")
else
echo "${LINE_PREFIX} Fetching latest release archives"
releasedata=$(curl -Lf "https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest")
versiontag=$(jq -r ".tag_name" <<< ${releasedata})
num=$(jq ".assets | length" <<< ${releasedata})
files=($(jq -r ".assets[].name | @sh" <<< ${releasedata}))
versiontag=$(jq -r ".tag_name" <<< "${releasedata}")
num=$(jq ".assets | length" <<< "${releasedata}")
files=()
while IFS='' read -r file; do
files+=("$file")
done < <(jq -r ".assets[].name | @sh" <<< "${releasedata}")
fi
echo "${LINE_PREFIX} Found ${num} artifacts"
@ -59,7 +65,7 @@ if [ $# -gt 2 ]; then
exit 2
fi
for assetname in ${files[@]}; do
for assetname in "${files[@]}"; do
assetname=${assetname:1:-1}
if [[ ! "${assetname}" =~ ^"${pattern}" ]]; then
continue