Skip to content

Commit d43bb00

Browse files
committed
Restore bsd awk compatibility
1 parent b181821 commit d43bb00

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

data/terraform-docs.awk

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
# [START] variable or output block started
18-
if ($0 ~ /^\s*(variable|output)\s+"(.*?)"/) {
18+
if ($0 ~ /^[[:space:]]*(variable|output)[[:space:]][[:space:]]*"(.*?)"/) {
1919
# Normalize the braceCnt (should be 1 now)
2020
braceCnt = 1
2121
# [CLOSE] "default" block
@@ -28,17 +28,21 @@
2828

2929
# [START] multiline default statement started
3030
if (blockCnt > 0) {
31-
if ($0 ~ /^\s*default\s*=/) {
32-
print $0
33-
blockDefCnt++
34-
blockDefStart=1
31+
if ($0 ~ /^[[:space:]][[:space:]]*(default)[[:space:]][[:space:]]*=/) {
32+
if ($3 ~ "null") {
33+
print " default = \"null\""
34+
} else {
35+
print $0
36+
blockDefCnt++
37+
blockDefStart=1
38+
}
3539
}
3640
}
3741

3842
# [PRINT] single line "description"
3943
if (blockCnt > 0) {
4044
if (blockDefCnt == 0) {
41-
if ($0 ~ /^\s*description\s*=/) {
45+
if ($0 ~ /^[[:space:]][[:space:]]*description[[:space:]][[:space:]]*=/) {
4246
# [CLOSE] "default" block
4347
if (blockDefCnt > 0) {
4448
blockDefCnt = 0
@@ -50,7 +54,7 @@
5054

5155
# [PRINT] single line "type"
5256
if (blockCnt > 0) {
53-
if ($0 ~ /^\s*type\s*=/ ) {
57+
if ($0 ~ /^[[:space:]][[:space:]]*type[[:space:]][[:space:]]*=/ ) {
5458
# [CLOSE] "default" block
5559
if (blockDefCnt > 0) {
5660
blockDefCnt = 0

0 commit comments

Comments
 (0)