mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
feat: When a config file is given, do not specify formatter on cli (terraform_docs) (#386)
This commit is contained in:
parent
5e927033d4
commit
962054b923
1 changed files with 7 additions and 2 deletions
|
|
@ -135,6 +135,11 @@ function terraform_docs {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Override formatter if no config file set
|
||||||
|
#
|
||||||
|
[[ "$args" != *"--config="* ]] && local tf_docs_formatter="md"
|
||||||
|
|
||||||
local dir_path
|
local dir_path
|
||||||
for dir_path in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
for dir_path in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
|
||||||
dir_path="${dir_path//__REPLACED__SPACE__/ }"
|
dir_path="${dir_path//__REPLACED__SPACE__/ }"
|
||||||
|
|
@ -181,7 +186,7 @@ function terraform_docs {
|
||||||
|
|
||||||
if [[ "$terraform_docs_awk_file" == "0" ]]; then
|
if [[ "$terraform_docs_awk_file" == "0" ]]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
terraform-docs md $args ./ > "$tmp_file"
|
terraform-docs $tf_docs_formatter $args ./ > "$tmp_file"
|
||||||
else
|
else
|
||||||
# Can't append extension for mktemp, so renaming instead
|
# Can't append extension for mktemp, so renaming instead
|
||||||
local tmp_file_docs
|
local tmp_file_docs
|
||||||
|
|
@ -192,7 +197,7 @@ function terraform_docs {
|
||||||
|
|
||||||
awk -f "$terraform_docs_awk_file" ./*.tf > "$tmp_file_docs_tf"
|
awk -f "$terraform_docs_awk_file" ./*.tf > "$tmp_file_docs_tf"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
terraform-docs md $args "$tmp_file_docs_tf" > "$tmp_file"
|
terraform-docs $tf_docs_formatter $args "$tmp_file_docs_tf" > "$tmp_file"
|
||||||
rm -f "$tmp_file_docs_tf"
|
rm -f "$tmp_file_docs_tf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue