@@ -41,6 +41,14 @@ set -euo pipefail
4141# ==============================================================================
4242
4343function main() {
44+ if [[ ${#@ } != 0 ]] && declare -f " main-tool-wrapper$1 " > /dev/null 2>&1 ; then
45+ " main-tool-wrapper$1 " " ${@: 2} "
46+ else
47+ main-invocation " $@ "
48+ fi
49+ }
50+
51+ function main-invocation() {
4452
4553 cd " $( git rev-parse --show-toplevel) "
4654
@@ -67,17 +75,17 @@ function main() {
6775 esac
6876
6977 if command -v editorconfig > /dev/null 2>&1 && ! is-arg-true " ${FORCE_USE_DOCKER:- false} " ; then
70- filter=" $filter " dry_run_opt=" ${dry_run_opt:- } " run-editorconfig -natively
78+ filter=" $filter " dry_run_opt=" ${dry_run_opt:- } " scripts/githooks/check-file-format.sh - -natively
7179 else
72- filter=" $filter " dry_run_opt=" ${dry_run_opt:- } " run-editorconfig-in -docker
80+ filter=" $filter " dry_run_opt=" ${dry_run_opt:- } " scripts/githooks/check-file-format.sh --via -docker
7381 fi
7482}
7583
7684# Run editorconfig natively.
7785# Arguments (provided as environment variables):
7886# dry_run_opt=[dry run option]
7987# filter=[git command to filter the files to check]
80- function run-editorconfig -natively() {
88+ function main-tool-wrapper- -natively() {
8189
8290 # shellcheck disable=SC2046,SC2086
8391 editorconfig \
@@ -88,7 +96,7 @@ function run-editorconfig-natively() {
8896# Arguments (provided as environment variables):
8997# dry_run_opt=[dry run option]
9098# filter=[git command to filter the files to check]
91- function run-editorconfig-in -docker() {
99+ function main-tool-wrapper--via -docker() {
92100
93101 # shellcheck disable=SC1091
94102 source ./scripts/docker/docker.lib.sh
0 commit comments