standout 7.2.0

Styled CLI template rendering with automatic terminal detection
Documentation
#!/bin/bash
set -e

echo "๐Ÿ”ง Running pre-commit checks..."

# Get list of staged Rust files
STAGED_RS_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.rs$' || true)

if [ -z "$STAGED_RS_FILES" ]; then
    echo "No Rust files staged, skipping Rust checks..."
else
    # Run cargo fmt and re-stage formatted files
    echo "๐Ÿ“ Running cargo fmt..."
    cargo fmt --all

    # Re-stage any files that were formatted
    for file in $STAGED_RS_FILES; do
        if [ -f "$file" ]; then
            git add "$file"
        fi
    done
    echo "โœ“ Formatting complete and changes re-staged"
fi

# Run clippy with auto-fix on the whole project (allow warnings during fix phase)
echo "๐Ÿ“Ž Running cargo clippy --fix..."
cargo clippy --fix --allow-dirty --allow-staged --all-targets --all-features 2>&1 || true

# Re-stage any files that clippy fixed
if [ -n "$STAGED_RS_FILES" ]; then
    for file in $STAGED_RS_FILES; do
        if [ -f "$file" ]; then
            git add "$file"
        fi
    done
    echo "โœ“ Clippy fixes applied and re-staged"
fi

# Run clippy and fail on any warnings (must match CI: --all-features)
echo "๐Ÿ“Ž Running clippy check..."
cargo clippy --all-targets --all-features -- -D warnings

# Ensure the code compiles
echo "๐Ÿ” Running cargo check..."
cargo check --all-targets

# Run tests
echo "๐Ÿงช Running cargo test..."
cargo test --all

echo "๐Ÿ“˜ Running doctests..."
cargo test --all --doc

echo "โœ… All pre-commit checks passed!"