mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
23 lines
411 B
Bash
Executable file
23 lines
411 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
declare -a paths
|
|
|
|
index=0
|
|
|
|
for file_with_path in "$@"; do
|
|
file_with_path="${file_with_path// /__REPLACED__SPACE__}"
|
|
|
|
paths[index]=$(dirname "$file_with_path")
|
|
|
|
let "index+=1"
|
|
done
|
|
|
|
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
|
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
|
|
|
|
pushd "$path_uniq" > /dev/null
|
|
terragrunt hclfmt
|
|
popd > /dev/null
|
|
done
|