mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Create a pre-commit hook which is copied on installation
Allow propogating specific files to format for black Update build messages for black update hook Update hook further, add related doc
This commit is contained in:
parent
4f7dd05d99
commit
bce9669d74
4 changed files with 44 additions and 3 deletions
27
manage
27
manage
|
|
@ -94,6 +94,9 @@ pyenv.:
|
|||
OK : test if virtualenv is OK
|
||||
format.:
|
||||
python : format Python code source using black
|
||||
git.:
|
||||
install : Installs developer git utilities, such as hooks
|
||||
uninstall : Removes developer git utilities previously installed
|
||||
pygments.:
|
||||
less : build LESS files for pygments
|
||||
EOF
|
||||
|
|
@ -316,9 +319,27 @@ pyenv.uninstall() {
|
|||
}
|
||||
|
||||
format.python() {
|
||||
build_msg TEST "[format.python] black \$BLACK_TARGETS"
|
||||
pyenv.cmd black "${BLACK_OPTIONS[@]}" "${BLACK_TARGETS[@]}"
|
||||
dump_return $?
|
||||
if [ -z "$1" ]; then
|
||||
build_msg TEST "[format.python] black \$BLACK_OPTIONS \$BLACK_TARGETS"
|
||||
pyenv.cmd black "${BLACK_OPTIONS[@]}" "${BLACK_TARGETS[@]}"
|
||||
else
|
||||
build_msg TEST "[format.python] black \$BLACK_OPTIONS $@"
|
||||
pyenv.cmd black "${BLACK_OPTIONS[@]}" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
git.install() {
|
||||
if [ -d ".git/hooks" ]; then
|
||||
cp .githooks/pre-commit .git/hooks/pre-commit
|
||||
else
|
||||
build_msg INSTALL "Could not find '.git/hooks', hooks were not installed"
|
||||
fi
|
||||
}
|
||||
|
||||
git.uninstall() {
|
||||
if [ -f ".git/hooks/pre-commit" ]; then
|
||||
rm .git/hooks/pre-commit
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2119
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue