pvc/format
Joshua M. Boniface ac885b855a Ensure all helper scripts pushd/popd
Make sure all of these move to the root of the repository first, then
return to where they were afterwards, using pushd/popd. This allows them
to be executed from anywhere in the repo.
2021-11-06 03:17:47 -04:00

19 lines
352 B
Bash
Executable File

#!/usr/bin/env bash
if ! which black &>/dev/null; then
echo "Black is required to format this project"
exit 1
fi
pushd $( git rev-parse --show-toplevel ) &>/dev/null
echo "Formatting..."
black --safe --exclude api-daemon/migrations .
ret=$?
if [[ $ret -eq 0 ]]; then
echo "Successfully formatted project!"
fi
popd &>/dev/null
exit $ret