Lines 49-69
zig-set_EZIG() {
Link Here
|
49 |
return |
49 |
return |
50 |
fi |
50 |
fi |
51 |
|
51 |
|
52 |
local candidates candidate selected selected_ver |
52 |
local candidate selected selected_ver ver |
53 |
|
53 |
|
54 |
candidates=$(compgen -c zig-) |
54 |
for candidate in "${BROOT}"/usr/bin/zig-*; do |
55 |
|
55 |
if [[ ! -L ${candidate} || ${candidate} != */zig?(-bin)-+([0-9.]) ]]; then |
56 |
for candidate in ${candidates}; do |
|
|
57 |
if [[ ! ${candidate} =~ zig(-bin)?-([.0-9]+) ]]; then |
58 |
continue |
56 |
continue |
59 |
fi |
57 |
fi |
60 |
|
58 |
|
61 |
local ver |
59 |
ver=${candidate##*-} |
62 |
if (( ${#BASH_REMATCH[@]} == 3 )); then |
|
|
63 |
ver="${BASH_REMATCH[2]}" |
64 |
else |
65 |
ver="${BASH_REMATCH[1]}" |
66 |
fi |
67 |
|
60 |
|
68 |
if [[ -n ${EZIG_EXACT_VER} ]]; then |
61 |
if [[ -n ${EZIG_EXACT_VER} ]]; then |
69 |
ver_test "${ver}" -ne "${EZIG_EXACT_VER}" && continue |
62 |
ver_test "${ver}" -ne "${EZIG_EXACT_VER}" && continue |
Lines 96-106
zig-set_EZIG() {
Link Here
|
96 |
done |
89 |
done |
97 |
|
90 |
|
98 |
if [[ -z ${selected} ]]; then |
91 |
if [[ -z ${selected} ]]; then |
99 |
die "Could not find (suitable) zig installation in PATH" |
92 |
die "Could not find (suitable) zig installation in ${BROOT}/usr/local/bin" |
100 |
fi |
93 |
fi |
101 |
|
94 |
|
102 |
export EZIG="${selected}" |
95 |
export EZIG="${selected}" |
103 |
export EZIG_VER="${ver}" |
96 |
export EZIG_VER="${selected_ver}" |
104 |
} |
97 |
} |
105 |
|
98 |
|
106 |
# Invoke zig with the optionally provided arguments. |
99 |
# Invoke zig with the optionally provided arguments. |
107 |
- |
|
|