Skip to content

Commit 3c8734d

Browse files
cschroeryermulnik
andauthored
fix(terraform_docs): Fix non-GNU sed issues, introduced in v1.93.0 (antonbabenko#704)
--------- Co-authored-by: George L. Yermulnik <yz@yz.kiev.ua>
1 parent 99fceb8 commit 3c8734d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ Unlike most other hooks, this hook triggers once if there are any changed files
585585
To migrate everything to `terraform-docs` insertion markers, run in repo root:
586586

587587
```bash
588-
grep -rl 'BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK' . | xargs sed -i 's/BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK/BEGIN_TF_DOCS/g'
589-
grep -rl 'END OF PRE-COMMIT-TERRAFORM DOCS HOOK' . | xargs sed -i 's/END OF PRE-COMMIT-TERRAFORM DOCS HOOK/END_TF_DOCS/g'
588+
grep -rl --null 'BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK' . | xargs -0 sed -i'' -e 's/BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK/BEGIN_TF_DOCS/'
589+
grep -rl --null 'END OF PRE-COMMIT-TERRAFORM DOCS HOOK' . | xargs -0 sed -i'' -e 's/END OF PRE-COMMIT-TERRAFORM DOCS HOOK/END_TF_DOCS/'
590590
```
591591

592592
```yaml

hooks/terraform_docs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ function main {
4040
function replace_old_markers {
4141
local -r file=$1
4242

43-
sed -i "s/^${old_insertion_marker_begin}$/${insertion_marker_begin}/" "$file"
44-
sed -i "s/^${old_insertion_marker_end}$/${insertion_marker_end}/" "$file"
43+
sed -i'' -e "s/^${old_insertion_marker_begin}$/${insertion_marker_begin}/" "$file"
44+
sed -i'' -e "s/^${old_insertion_marker_end}$/${insertion_marker_end}/" "$file"
4545
}
4646

4747
#######################################################################

0 commit comments

Comments
 (0)