Skip to content

Commit

Permalink
chore: add optional pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lamchau committed Sep 26, 2024
1 parent 4704b82 commit d7aea4e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ coverage *FLAGS:
docs:
uv sync && uv run mkdocs serve

install-hooks:
#!/usr/bin/env bash
HOOKS_DIR="$(git rev-parse --git-path hooks)"
if [ ! -d "$HOOKS_DIR" ]; then
mkdir -p "$HOOKS_DIR"
fi

cat > "$HOOKS_DIR/pre-commit" <<EOF
#!/usr/bin/env bash
just format
EOF

if [ ! -f "$HOOKS_DIR/pre-commit" ]; then
echo "[error]: failed to create pre-commit hook at $HOOKS_DIR/pre-commit"
exit 1
fi
chmod +x "$HOOKS_DIR/pre-commit"

ai-exchange-version:
curl -s https://pypi.org/pypi/ai-exchange/json | jq -r .info.version
Expand Down

0 comments on commit d7aea4e

Please sign in to comment.