2023-08-07 18:51:45 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-08-07 17:18:47 +00:00
|
|
|
|
2023-08-07 18:51:45 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [ ! -z "$MODULE" ]; then
|
2023-08-07 17:18:47 +00:00
|
|
|
MODULE="-p $MODULE"
|
|
|
|
fi
|
|
|
|
|
2023-08-07 18:51:45 +00:00
|
|
|
if [ -z "${PARAMS-}" ]; then
|
|
|
|
PARAMS=""
|
|
|
|
fi
|
|
|
|
|
2023-08-07 17:18:47 +00:00
|
|
|
case $CMD in
|
|
|
|
build)
|
|
|
|
$CARGO build $MODULE $PARAMS
|
|
|
|
;;
|
2023-10-04 19:57:10 +00:00
|
|
|
lint)
|
|
|
|
$CARGO clippy $MODULE $PARAMS -- -Dwarnings
|
|
|
|
;;
|
2023-08-07 17:18:47 +00:00
|
|
|
test)
|
|
|
|
$CARGO test $MODULE $PARAMS
|
|
|
|
;;
|
2023-08-07 20:43:06 +00:00
|
|
|
run)
|
|
|
|
$CARGO run $MODULE $PARAMS
|
|
|
|
;;
|
2023-08-07 17:18:47 +00:00
|
|
|
release)
|
2023-10-04 19:57:10 +00:00
|
|
|
$CARGO clippy $MODULE $PARAMS -- -Dwarnings
|
2023-08-07 22:34:02 +00:00
|
|
|
$CARGO build --release $MODULE $PARAMS
|
2023-10-05 16:48:51 +00:00
|
|
|
$CARGO test --release $MODULE $PARAMS
|
2023-08-07 17:18:47 +00:00
|
|
|
;;
|
|
|
|
clean)
|
|
|
|
$CARGO clean $MODULE
|
|
|
|
;;
|
|
|
|
"")
|
2023-10-04 19:57:10 +00:00
|
|
|
echo "No command specified. Use build | lint | test | run | release | clean"
|
2023-08-07 17:18:47 +00:00
|
|
|
;;
|
|
|
|
*)
|
2023-10-04 19:57:10 +00:00
|
|
|
echo "$CMD is unknown. Use build | lint | test | run | release | clean"
|
2023-08-07 17:18:47 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|