docker-php-extension-installer/scripts/invoke-shfmt

41 lines
709 B
Plaintext
Raw Normal View History

2019-12-20 18:44:45 +01:00
#!/bin/sh
set -o errexit
set -o nounset
2021-08-11 11:41:35 +02:00
. ./scripts/common
# -s Simplify the code
# -ln posix Language variant: POSIX
# -i 0 Use TAB to indent
# -ci Switch cases will be indented
# -kp Keep column alignment paddings
DPEI_PARAMS='-s -ln posix -i 0 -ci -kp'
2019-12-20 18:44:45 +01:00
case "${1:-}" in
check)
2021-08-11 11:41:35 +02:00
DPEI_PARAMS="$DPEI_PARAMS -d"
2019-12-20 18:44:45 +01:00
;;
fix)
2021-08-11 11:41:35 +02:00
DPEI_PARAMS="$DPEI_PARAMS -w"
2019-12-20 18:44:45 +01:00
;;
*)
2021-08-11 11:41:35 +02:00
printf 'Syntax: %s <check|fix>\n' "$0" >&2
2019-12-20 18:44:45 +01:00
exit 1
;;
esac
2021-08-11 11:41:35 +02:00
DPEI_FILES=install-php-extensions
IFS='
'
for DPEI_FILE in $(find scripts -type f); do
if test "$(head -n1 $DPEI_FILE)" = '#!/bin/sh'; then
DPEI_FILES="$DPEI_FILES $DPEI_FILE"
fi
done
resetIFS
FORCE_COLOR=true shfmt $DPEI_PARAMS -- $DPEI_FILES