Improve the pre-commit hook

Now handles directories starting with `esp` which do *not* contain a `Cargo.toml` file!
This commit is contained in:
Jesse Braham 2023-05-01 07:27:22 -07:00 committed by Jesse Braham
parent ca7c0b377f
commit d316b066b0

View File

@ -8,7 +8,7 @@ command -v "cargo" >/dev/null 2>&1 || { echo >&2 "The 'cargo' command is not ins
command -v "rustfmt" >/dev/null 2>&1 || { echo >&2 "The 'rustfmt' command is not installed, exiting"; exit 1; }
# Check the formatting of all Rust code for every package.
for package in "esp"*/; do
for manifest in "esp"*/Cargo.toml; do
# Check package is correctly formatted.
cargo fmt --all --manifest-path "${package}Cargo.toml" -- --check
cargo fmt --all --manifest-path "${manifest}" -- --check
done