Skip to content

Commit d8ed113

Browse files
committed
fix: Exit with error when no matching assets
1 parent 4ef5cb8 commit d8ed113

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

gah

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ function find_download_url() {
203203
lower_line=$(echo "$line" | tr '[A-Z]' '[a-z]')
204204
if [[ "$lower_line" =~ $regexp ]]; then
205205
print_debug " $line ... Match!"
206+
found="true"
206207
line="${BASH_REMATCH[0]}"
207208
line=${line:1}
208209
line=${line::-1}
@@ -211,6 +212,13 @@ function find_download_url() {
211212
print_debug " $line ... Doesn't match"
212213
fi
213214
done
215+
216+
# If asset matched, return
217+
if [[ "$found" == "true" ]]; then
218+
return
219+
fi
220+
221+
print_debug "No download URLs found!"
214222
}
215223

216224
function find_digest_for_url() {
@@ -331,6 +339,13 @@ function command_install() {
331339

332340
# Find the download URL
333341
local download_url=$(find_download_url "$tmp_dir/release.json")
342+
343+
if [[ -z "$download_url" ]]; then
344+
local os=$(get_os)
345+
local arch=$(get_arch)
346+
throw_error 18 "Could not find any assets matching your OS ($os) and Arch ($arch)."
347+
fi
348+
334349
print_debug "Download URL:\n$download_url"
335350

336351
# Check if several download URLs were found

0 commit comments

Comments
 (0)