chore: Add shellcheck and make checks passing (#315)

Co-authored-by: Anton Babenko <anton@antonbabenko.com>
This commit is contained in:
Maksym Vlasov 2022-01-06 15:08:18 +02:00 committed by GitHub
commit 3045dd55a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 24 deletions

View file

@ -121,9 +121,11 @@ function terraform_docs {
local add_to_existing=false
local create_if_not_exist=false
configs=($hook_config)
read -r -a configs <<< "$hook_config"
for c in "${configs[@]}"; do
config=(${c//=/ })
IFS="=" read -r -a config <<< "$c"
key=${config[0]}
value=${config[1]}
@ -161,9 +163,11 @@ function terraform_docs {
dir="$(dirname "$text_file")"
mkdir -p "$dir"
echo -e "# ${PWD##*/}\n" >> "$text_file"
echo "<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->" >> "$text_file"
echo "<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->" >> "$text_file"
{
echo -e "# ${PWD##*/}\n"
echo "<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->"
echo "<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->"
} >> "$text_file"
fi
# If file still not exist - skip dir