dotgift/pre-commit.sh

10 lines
353 B
Bash
Raw Permalink Normal View History

2023-07-31 16:07:29 -07:00
#!/bin/bash
PROJECT_ROOT=$(git rev-parse --show-toplevel)
VERSION=$(grep 'version =' $PROJECT_ROOT/pyproject.toml | head -1 | cut -d '"' -f 2)
INIT_FILE="$PROJECT_ROOT/dotgift/dotgift/__init__.py"
# Portable workaround for macOS/Linux sed differences
sed -i.bak "s/__version__ = .*/__version__ = \"$VERSION\"/" $INIT_FILE && \
rm "$INIT_FILE.bak"