mirror of
https://github.com/espressif/openthread.git
synced 2025-05-17 15:26:16 +08:00
[scripts] apply shfmt changes (#4966)
This commit is contained in:
@ -29,7 +29,8 @@
|
||||
|
||||
CLANG_FORMAT_VERSION="clang-format version 6.0"
|
||||
|
||||
die() {
|
||||
die()
|
||||
{
|
||||
echo " *** ERROR: $*"
|
||||
exit 1
|
||||
}
|
||||
@ -38,12 +39,12 @@ die() {
|
||||
# expand_aliases shell option is set using shopt.
|
||||
shopt -s expand_aliases
|
||||
|
||||
if command -v clang-format-6.0 > /dev/null; then
|
||||
if command -v clang-format-6.0 >/dev/null; then
|
||||
alias clang-format=clang-format-6.0
|
||||
elif command -v clang-format > /dev/null; then
|
||||
elif command -v clang-format >/dev/null; then
|
||||
case "$(clang-format --version)" in
|
||||
"$CLANG_FORMAT_VERSION"*)
|
||||
;;
|
||||
"$CLANG_FORMAT_VERSION"*) ;;
|
||||
|
||||
*)
|
||||
die "$(clang-format --version); clang-format 6.0 required"
|
||||
;;
|
||||
@ -56,8 +57,7 @@ clang-format "$@" || die
|
||||
|
||||
# ensure EOF newline
|
||||
REPLACE=no
|
||||
for arg
|
||||
do
|
||||
for arg; do
|
||||
case $arg in
|
||||
-i)
|
||||
REPLACE=yes
|
||||
@ -68,7 +68,7 @@ done
|
||||
file=$arg
|
||||
|
||||
[ $REPLACE != yes ] || {
|
||||
[ -n "$(tail -c1 "$file")" ] && echo >> "$file"
|
||||
[ -n "$(tail -c1 "$file")" ] && echo >>"$file"
|
||||
}
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user