just: Introduce justfile with pre-push hook cmds

As part of migrating from `flake.nix` to a more universal task runner
that can manage git hooks too.
This commit is contained in:
Adrian Duke 2026-04-08 17:14:20 +01:00 committed by Fintan Halpenny
parent 430868ffb1
commit 9210f0871a
1 changed files with 26 additions and 0 deletions

26
justfile Normal file
View File

@ -0,0 +1,26 @@
default:
@just --list
# Run pre-push checks
pre-push: lint-rust
@echo "✅ pre-push passed"
# Run Clippy lints
lint-rust: (verify-tool "cargo")
@echo "Cargo clippy..."
@cargo clippy --workspace --all-targets --all-features -- --deny warnings
# Check if required tools are in PATH.
[private]
verify-tool tool package_name="":
#!/usr/bin/env bash
set -e
if ! command -v {{tool}} >/dev/null 2>&1; then
PKG="{{package_name}}"
if [ -z "$PKG" ]; then
PKG="{{tool}}"
fi
echo "❌ Missing required tool: {{tool}}"
echo "💡 Use your systems package manager to install '$PKG'."
exit 1
fi