check.rs/bin/cli

29 lines
548 B
Bash
Executable File

#! /usr/bin/env bash
ORIGDIR="$(pwd)"
SCRIPTDIR="$(dirname "$0")"
BASEDIR="$(realpath "$SCRIPTDIR"/..)"
cd "$BASEDIR"
if [ -f target/release/whck ]; then
output="$(cargo build --release 2>&1)"
if [ $? -eq 0 ]; then
# Build succeeded echo path to binary
echo "$BASEDIR"/target/release/whck
else
echo "$output"
exit 1
fi
else
output="$(cargo build 2>&1)"
if [ $? -eq 0 ]; then
echo "$BASEDIR"/target/debug/whck
else
echo "$output"
exit 1
fi
fi
cd "$ORIGDIR"