sea-orm/build-tools/rustfmt.sh
kyoto7250 dd545441d3
introduce rustfmt (#919)
* introduce rustfmt

* Cargofmt on all sea-orm crates & examples

* Revert testing script

* cargo fmt --manifest-path sea-orm-rocket/Cargo.toml --all

* add a script for formatting

* add nightly component for formatting

* set timeout and manual nightly install  in github action

* add flag for manifest-path

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-08-01 18:30:43 +08:00

25 lines
734 B
Bash

#!/bin/bash
set -e
if [ -d ./build-tools ]; then
targets=(
"sea-orm-cli/Cargo.toml"
"sea-orm-codegen/Cargo.toml"
"sea-orm-macros/Cargo.toml"
"sea-orm-migration/Cargo.toml"
"sea-orm-rocket/Cargo.toml"
)
for target in "${targets[@]}"; do
echo "cargo +nightly fmt --manifest-path ${target} --all"
cargo +nightly fmt --manifest-path "${target}" --all
done
examples=(`find examples -type f -name 'Cargo.toml'`)
for example in "${examples[@]}"; do
echo "cargo +nightly fmt --manifest-path ${example} --all"
cargo +nightly fmt --manifest-path "${example}" --all
done
else
echo "Please execute this script from the repository root."
fi