mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
Added shfmt to autoformat shell scripts (#86)
This commit is contained in:
parent
07730a425a
commit
1e5b3af0d2
4 changed files with 269 additions and 209 deletions
|
|
@ -9,13 +9,13 @@ for file_with_path in "$@"; do
|
|||
file_with_path="${file_with_path// /__REPLACED__SPACE__}"
|
||||
|
||||
paths[index]=$(dirname "$file_with_path")
|
||||
(( "index+=1" ))
|
||||
(("index+=1"))
|
||||
done
|
||||
|
||||
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
||||
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
|
||||
|
||||
if [[ -n "$(find . -maxdepth 1 -name '*.tf' -print -quit)" ]] ; then
|
||||
if [[ -n "$(find . -maxdepth 1 -name '*.tf' -print -quit)" ]]; then
|
||||
if ! terraform validate $path_uniq; then
|
||||
error=1
|
||||
echo
|
||||
|
|
@ -25,6 +25,6 @@ for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
|||
fi
|
||||
done
|
||||
|
||||
if [[ "${error}" -ne 0 ]] ; then
|
||||
if [[ "${error}" -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue