cram/tools/fmt.sh

24 lines
511 B
Bash
Raw Normal View History

2022-07-29 05:38:26 +00:00
#!/usr/bin/env bash
set -euox pipefail
cd "$(git rev-parse --show-toplevel)"
bazel build //tools/...
DIRS=(tools src/python test/python)
function brl() {
bin="$1"
shift
bazel build "//${bin}"
"bazel-bin/${bin}/$(basename ${bin})" "$@"
return "$?"
}
for d in "${DIRS[@]}"; do
if [ -d "$d" ]; then
brl tools/autoflake --remove-all-unused-imports -ir $(realpath "$d")
brl tools/isort $(realpath "$d")
brl tools/unify --quote '"' -ir $(realpath "$d")
fi
done