Skip to content

Commit aff673d

Browse files
committed
Detect deps (jq, curl) and cleanups
1 parent 3902e72 commit aff673d

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

bin/list-all

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ toolname=$(basename "$plugin_dir")
99
# shellcheck source=../lib/utils.bash
1010
source "${plugin_dir}/lib/utils.bash"
1111

12+
validate_deps
1213
validate_platform
1314

1415
list_all_versions "${toolname}" | sort_versions | xargs echo

lib/utils.bash

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ fail() {
1616
exit 1
1717
}
1818

19+
validate_deps() {
20+
21+
deps=(jq curl)
22+
23+
for d in "${deps[@]}"; do
24+
if ! command -v "$d" >/dev/null; then
25+
fail "Required dependency '$d' not found."
26+
fi
27+
done
28+
}
29+
1930
curl_opts=(-fsSL)
2031

2132
# NOTE: You might want to remove this if clang-tools-static is not hosted on GitHub releases.
@@ -40,36 +51,6 @@ fetch_all_assets() {
4051
jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"'
4152
}
4253

43-
get_kernel() {
44-
45-
local kernel
46-
kernel=$(uname -s)
47-
48-
case $kernel in
49-
Darwin)
50-
echo -n "macosx"
51-
;;
52-
Linux)
53-
echo -n "linux"
54-
;;
55-
esac
56-
57-
echo -n ""
58-
}
59-
60-
get_arch() {
61-
local arch
62-
arch=$(uname -m)
63-
64-
case $arch in
65-
x86_64)
66-
echo -n "amd64"
67-
;;
68-
esac
69-
70-
echo -n "$"
71-
}
72-
7354
validate_platform() {
7455

7556
if [ -n "${USE_PLATFORM}" ]; then

0 commit comments

Comments
 (0)