Add linting/formatting and convert to module
This commit is contained in:
22
format
Executable file
22
format
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if ! which black &>/dev/null; then
|
||||
echo "Black is required to format this project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $1 == "check" ]]; then
|
||||
check="--check"
|
||||
fi
|
||||
|
||||
pushd $( git rev-parse --show-toplevel ) &>/dev/null
|
||||
|
||||
echo ">>> Formatting..."
|
||||
black --safe ${check} .
|
||||
ret=$?
|
||||
if [[ $ret -eq 0 ]]; then
|
||||
echo "Successfully formatted project!"
|
||||
fi
|
||||
|
||||
popd &>/dev/null
|
||||
exit $ret
|
Reference in New Issue
Block a user