From 6e2b54b36b25de1c1e6765f5943821dd8b40cf9d Mon Sep 17 00:00:00 2001 From: Milos Jajac Date: Tue, 16 Nov 2021 17:11:29 +0100 Subject: [PATCH 1/4] fix typo in arg name for terraform-docs --- README.md | 2 +- terraform_docs.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8a60c6200..1720626bc 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,7 @@ Unlike most other hooks, this hook triggers once if there are any changed files - id: terraform_docs args: - --hook-config=--path-to-file=README.md # Valid UNIX path. I.e. ../TFDOC.md or docs/README.md etc. - - --hook-config=--add-to-exiting-file=true # Boolean. true or false + - --hook-config=--add-to-existing-file=true # Boolean. true or false - --hook-config=--create-file-if-not-exist=true # Boolean. true or false ``` diff --git a/terraform_docs.sh b/terraform_docs.sh index 1152cb110..3b04afe24 100755 --- a/terraform_docs.sh +++ b/terraform_docs.sh @@ -119,7 +119,7 @@ terraform_docs() { # Get hook settings # local text_file="README.md" - local add_to_exiting=false + local add_to_existing=false local create_if_not_exist=false configs=($hook_config) @@ -132,8 +132,8 @@ terraform_docs() { --path-to-file) text_file=$value ;; - --add-to-exiting-file) - add_to_exiting=$value + --add-to-existing-file) + add_to_existing=$value ;; --create-file-if-not-exist) create_if_not_exist=$value @@ -171,10 +171,10 @@ terraform_docs() { [[ ! -f "$text_file" ]] && popd > /dev/null && continue # - # If `--add-to-exiting-file=true` set, check is in file exist "hook markers", + # If `--add-to-existing-file=true` set, check is in file exist "hook markers", # and if not - append "hook markers" to the end of file. # - if $add_to_exiting; then + if $add_to_existing; then HAVE_MARKER=$(grep -o '' "$text_file" || exit 0) if [ ! "$HAVE_MARKER" ]; then From 21f931ac84b2d3c6b42322c5ad67ee09a2b17b8f Mon Sep 17 00:00:00 2001 From: Maksym Vlasov Date: Wed, 17 Nov 2021 20:05:37 +0200 Subject: [PATCH 2/4] Apply suggestions from code review --- terraform_docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform_docs.sh b/terraform_docs.sh index 3b04afe24..899729160 100755 --- a/terraform_docs.sh +++ b/terraform_docs.sh @@ -132,7 +132,7 @@ terraform_docs() { --path-to-file) text_file=$value ;; - --add-to-existing-file) + --add-to-existing-file|--add-to-exiting-file) # Typo left for compatibility. Will removed in 2.0.0. add_to_existing=$value ;; --create-file-if-not-exist) From 203e26a4bbee09409555cde87a1d93d05efc6e90 Mon Sep 17 00:00:00 2001 From: Maksym Vlasov Date: Wed, 17 Nov 2021 20:10:06 +0200 Subject: [PATCH 3/4] Apply suggestions from code review --- terraform_docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform_docs.sh b/terraform_docs.sh index 899729160..724f755fd 100755 --- a/terraform_docs.sh +++ b/terraform_docs.sh @@ -132,7 +132,7 @@ terraform_docs() { --path-to-file) text_file=$value ;; - --add-to-existing-file|--add-to-exiting-file) # Typo left for compatibility. Will removed in 2.0.0. + --add-to-existing-file|--add-to-exiting-file) # Typo left for compatibility. Will be removed in 2.0.0. add_to_existing=$value ;; --create-file-if-not-exist) From be5f1f3a8f7d743cac21b058f1892077b7295761 Mon Sep 17 00:00:00 2001 From: Maksym Vlasov Date: Wed, 17 Nov 2021 20:13:02 +0200 Subject: [PATCH 4/4] Update terraform_docs.sh --- terraform_docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform_docs.sh b/terraform_docs.sh index 724f755fd..3b04afe24 100755 --- a/terraform_docs.sh +++ b/terraform_docs.sh @@ -132,7 +132,7 @@ terraform_docs() { --path-to-file) text_file=$value ;; - --add-to-existing-file|--add-to-exiting-file) # Typo left for compatibility. Will be removed in 2.0.0. + --add-to-existing-file) add_to_existing=$value ;; --create-file-if-not-exist)