#!/usr/bin/env bash function cargo-checks() { cargo test --all-features cargo clippy -r --all-targets --all-features --locked cargo +nightly fmt --check cargo doc --no-deps -r --all-features } function cargo-rdme() { cargo rdme >README.md if ! git diff --quiet README.md; then echo "README.md has been changed; commiting." git add README.md && git commit -m "docs: Update README.md" fi } # Runs cargo build on all given targets for the given bin function cargo-build-targets() { local bin_name targets version target bin_name=$1 targets=$2 version=v$(crate-version) for target in ${targets}; do local extension="" # Check if target has "windows" in it. if yes, add ".exe" to the generated binary name if [[ $target == *windows* ]]; then extension=".exe" fi cargo build --bin "$bin_name" --release --target="$target" && cp -v "target/$target/release/$bin_name$extension" "target/release/$bin_name.$target.$version$extension" done }