27 lines
415 B
Bash
Executable File
27 lines
415 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
|
|
SCRIPT="${BASH_SOURCE[0]}"
|
|
|
|
fail() {
|
|
echo "ERR - $SCRIPT: $1"
|
|
exit 1
|
|
}
|
|
|
|
DIR="$1"
|
|
if [[ -z $DIR ]]; then
|
|
DIR=$(pwd)
|
|
fi
|
|
if [[ ! -d $DIR ]]; then
|
|
echo "Usage: $SCRIPT <Project Directory>"
|
|
exit 1
|
|
fi
|
|
|
|
pushd "$DIR" || fail "Couldn't enter directory."
|
|
if [[ -x "run.sh" ]]; then
|
|
./run.sh
|
|
elif [[ -f "Cargo.toml" ]]; then
|
|
cargo run
|
|
fi
|
|
popd >/dev/null || exit 1
|