# justfile — task runner. See: https://just.systems/
# Available via `nix develop` (or install `just` yourself).

default:
    @just --list

# --- cargo ---

build:
    cargo build

build-release:
    cargo build --release

run *args:
    cargo run -- {{ args }}

test:
    cargo test

bench:
    cargo bench

clippy:
    cargo clippy --all-targets -- --deny warnings

fmt:
    nix fmt

fmt-check:
    nix fmt -- --fail-on-change

audit:
    cargo audit

doc:
    cargo doc --no-deps

doc-open:
    cargo doc --no-deps --open

# Everything nix flake check runs, but via cargo for a faster local loop
ci: fmt-check clippy test audit doc

clean:
    cargo clean
    rm -rf result result-*

# Background code checker (bacon)
watch:
    bacon

# --- nix ---

nix-build:
    nix build

nix-check:
    nix flake check

nix-develop:
    nix develop

nix-update:
    nix flake update

# --- template ---

# Rename the "rust_template" placeholder to <name> (snake_case)
rename name:
    ./scripts/rename-project.sh {{ name }}
