Luigit
repositories / bugabinga.net

bugabinga.net

personal infrastructure for bugabinga!

owned by admin

scripts/local/rust.sh

Raw
#!/usr/bin/env bash
set -euo pipefail

repo_root="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
cd "${repo_root}/services/luigit"

usage() {
  echo "usage: rust.sh fmt | clippy | test" >&2
  exit 2
}

case "${1:-}" in
  fmt)
    [[ "$#" -eq 1 ]] || usage
    exec cargo fmt --check --all
    ;;
  clippy)
    [[ "$#" -eq 1 ]] || usage
    exec cargo clippy --locked --all-targets -- -D warnings
    ;;
  test)
    [[ "$#" -eq 1 ]] || usage
    exec cargo test --locked
    ;;
  *)
    usage
    ;;
esac