diff --git a/hooks/tflint.sh b/hooks/tflint.sh index f999755e..888c7a34 100755 --- a/hooks/tflint.sh +++ b/hooks/tflint.sh @@ -10,6 +10,21 @@ export PATH=$PATH:/usr/local/bin # Install any plugins defined in .tflint.hcl tflint --init -for file in "$@"; do - tflint $file + +declare -a FILES +declare -a ARGS +while [[ $# -gt 0 ]] +do + case "$1" in + -*) ARGS+=("$1") + ;; + *) FILES+=("$1") + ;; + esac + shift +done + +for file in "${FILES[@]}" +do + tflint "${ARGS[@]}" "$file" done