#!/usr/bin/env execlineb
# SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
# SPDX-License-Identifier: BSD-2-Clause

elgetopt "c:"
importas -D "cargo" default_cargo CARGO
importas -D $default_cargo CARGO ELGETOPT_c
if {
  $CARGO fmt --check
}
if {
  $CARGO fc build
}
if {
  $CARGO doc --no-deps --all-features
}
if {
  $CARGO fc nextest run
}
if {
  backtick -E -I nix_shell_version {
    redirfd -w 2 /dev/null
    nix-shell --version
  }
  ifelse {
    eltest $? -ne 0 -o -z $nix_shell_version
  } {
    echo "No nix-shell program, skipping reuse"
  }
  nix-shell --pure -p git -p reuse --run "reuse lint"
}
if {
  tools/el-run-clippy -c $CARGO -n
}
echo "Seems fine"
