From 0f0a07c7fe59110f76c9d5375f2be90131291641 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Wed, 11 Aug 2021 11:41:35 +0200 Subject: [PATCH] Test all posix scripts --- scripts/invoke-shfmt | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/scripts/invoke-shfmt b/scripts/invoke-shfmt index b071c2c..ec97e0e 100755 --- a/scripts/invoke-shfmt +++ b/scripts/invoke-shfmt @@ -3,28 +3,38 @@ set -o errexit set -o nounset -PARAMS='-s -ln posix -i 0 -ci -kp' +. ./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' case "${1:-}" in check) - PARAMS="$PARAMS -d" + DPEI_PARAMS="$DPEI_PARAMS -d" ;; fix) - PARAMS="$PARAMS -w" + DPEI_PARAMS="$DPEI_PARAMS -w" ;; *) - printf 'Syntax: %s ' "$0" >&2 + printf 'Syntax: %s \n' "$0" >&2 exit 1 ;; esac -shfmt $PARAMS \ - install-php-extensions \ - scripts/ci-filter-supported-extensions \ - scripts/ci-retrieve-recent-extensions \ - scripts/ci-test-extensions \ - scripts/common \ - scripts/invoke-shfmt \ - scripts/lint \ - scripts/test-restore-apt \ - scripts/update-readme +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