aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer <joewinzer@googlemail.com>2021-02-10 19:15:19 +0100
committerJoseph-Eugene Winzer <joewinzer@googlemail.com>2021-02-11 16:58:24 +0100
commite3ac8f0f09c6ea1e994797a6f7ed4384563f2e4f (patch)
tree2028073899a55683fb65e380fe1d318e4a870012
parentbb5c219daec42be742e81f726ebdcfae4219e084 (diff)
downloadziglings-e3ac8f0f09c6ea1e994797a6f7ed4384563f2e4f.tar.gz
ziglings-e3ac8f0f09c6ea1e994797a6f7ed4384563f2e4f.tar.bz2
ziglings-e3ac8f0f09c6ea1e994797a6f7ed4384563f2e4f.tar.xz
ziglings-e3ac8f0f09c6ea1e994797a6f7ed4384563f2e4f.zip
Added a zig version test
-rwxr-xr-xziglings15
1 files changed, 14 insertions, 1 deletions
diff --git a/ziglings b/ziglings
index 7c2f6a1..e941411 100755
--- a/ziglings
+++ b/ziglings
@@ -17,6 +17,19 @@ fmt_err=$( tput setaf 1 ) # red foreground
fmt_yay=$( tput setaf 2 ) # green foreground
fmt_off=$( tput sgr0 ) # reset colors/effects
+zig_cmd=zig
+zig_version_required=( 0 8 0 )
+zig_version=$($zig_cmd version)
+zig_version=(${zig_version//./ })
+
+if [[ ${zig_version[0]} -ne ${zig_version_required[0]} || ${zig_version[1]} -lt ${zig_version_required[1]} ]]
+then
+ echo "Your current zig version is $(IFS=$'.'; echo "${zig_version[*]}")."
+ echo "Please update your zig compiler to a version >=$(IFS=$'.'; echo "${zig_version_required[*]}") "`
+ `"or change zig_cmd in ./ziglings to the appropriate path."
+ exit 1
+fi
+
exercise_num=0
function check_it {
@@ -32,7 +45,7 @@ function check_it {
fi
# Compile/run the source and capture the result and exit value
- cmd="zig run $source_file"
+ cmd="$zig_cmd run $source_file"
echo "$ $cmd"
result=$($cmd 2>&1)
result_status=$?