freeswitch-log-parser 0.8.0

Parser for FreeSWITCH log files — handles compressed .xz files, multi-line dumps, truncated buffers, and stateful UUID/timestamp tracking
Documentation
#!/bin/bash
# Pre-commit hook: fmt, clippy, tests, gitleaks

set -e

echo "Running cargo fmt check..."
if ! cargo fmt --all -- --check; then
	echo "Code is not formatted. Run 'cargo fmt --all' to fix."
	exit 1
fi

echo "Running cargo clippy..."
if ! cargo clippy --all-targets --features tui --message-format=short -- -D warnings; then
	echo "Clippy found warnings. Fix them before committing."
	exit 1
fi

echo "Running tests..."
if ! test_output=$(cargo test --release --features tui 2>&1); then
	echo "$test_output" | tail
	echo "Tests failed. Fix them before committing."
	exit 1
fi

echo "Running gitleaks..."
# --staged scans exactly what is about to be committed; `detect` only scans
# already-committed history and lets staged secrets through (it did once).
# .gitleaks.local.toml extends the committed config with private patterns
# and is never committed itself (.git/info/exclude).
GITLEAKS_ARGS=()
if [ -f .gitleaks.local.toml ]; then
	GITLEAKS_ARGS=(--config .gitleaks.local.toml)
fi
if ! gitleaks git --staged --no-banner "${GITLEAKS_ARGS[@]}"; then
	echo "gitleaks detected secrets in the staged changes. Remove them before committing."
	exit 1
fi

echo "Pre-commit checks passed"