Skip to content

Commit a70b87d

Browse files
authored
Add back a format script for compat (#2174)
This will just call pre-commit (but skip api-gen). Will also prompt users to install if not installed, I've noticed a lot of unformatted PRs as of late.
1 parent ff52088 commit a70b87d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

shell/api_gen.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ set -Eeuo pipefail
33

44
base_dir=$(dirname $(dirname $0))
55

6+
if ! command -v pre-commit 2>&1 >/dev/null
7+
then
8+
echo 'Please `pip install pre-commit` to run api_gen.sh.'
9+
exit 1
10+
fi
11+
612
echo "Generating api directory with public APIs..."
713
# Generate API Files
814
python3 "${base_dir}"/api_gen.py

shell/format.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -Eeuo pipefail
3+
4+
if ! command -v pre-commit 2>&1 >/dev/null
5+
then
6+
echo 'Please `pip install pre-commit` to run format.sh.'
7+
exit 1
8+
fi
9+
10+
base_dir=$(dirname $(dirname $0))
11+
12+
echo "Formatting all files..."
13+
SKIP=api-gen pre-commit run --all-files

0 commit comments

Comments
 (0)