Skip to content

Commit

Permalink
Never completely overwrite readme (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
GabeL7r authored Dec 4, 2019
1 parent c5a7a6d commit be48ae7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions terraform_readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
DOCS=$(terraform-config-inspect "$path_uniq")
perl -i -s0pe 's/(<!-- BEGINNING OF TERRAFORM-DOCS HOOK -->).*(<!-- END OF TERRAFORM-DOCS HOOK -->)/\1\n$replacement\n\2/s' -- -replacement="$DOCS" "$README_PATH"
else
# Assume the entire file is autogenerated. Replace the contents with the new generated docs and add the hook so future changes won't hit this code path
echo "<!-- BEGINNING OF TERRAFORM-DOCS HOOK -->" > $README_PATH
echo "<!-- BEGINNING OF TERRAFORM-DOCS HOOK -->" >> $README_PATH
terraform-config-inspect "$path_uniq" >> $README_PATH
echo "<!-- END OF TERRAFORM-DOCS HOOK -->" >> $README_PATH
echo "Updating $README_PATH, please git add."
Expand Down

0 comments on commit be48ae7

Please sign in to comment.