mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00

Allow propogating specific files to format for black Update build messages for black update hook Update hook further, add related doc
12 lines
503 B
Bash
Executable file
12 lines
503 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ "$SEARXNG_PRECOMMIT" = "true" ]; then
|
|
# inspired from: https://prettier.io/docs/en/precommit.html#option-4-shell-script
|
|
staged_files=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
|
|
python_files=$(echo "$staged_files" | grep '\.py$')
|
|
# Only attempt to run the formatter if Python files were changes
|
|
if [ -n "$python_files" ]; then
|
|
echo "$python_files" | xargs ./manage format.python
|
|
echo "$python_files" | xargs git add
|
|
fi
|
|
fi
|