File tree 4 files changed +11
-23
lines changed
4 files changed +11
-23
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ if [ "${#}" -ge "1" ]; then
111
111
# Remove first argument "replace"
112
112
shift ;
113
113
mkdir -p /tmp-012
114
- awk -f /terraform-docs.awk -- * .tf > " /tmp-012/tmp.tf"
114
+ awk -f /terraform-docs.awk -- " $( dirname " ${MY_FILE} " ) / " * .tf > " /tmp-012/tmp.tf"
115
115
# Get terraform-docs output
116
116
>&2 echo " terraform-docs-012 ${* } $( dirname " ${MY_FILE} " ) "
117
117
if ! DOCS=" $( terraform-docs " ${@ } " " /tmp-012" ) " ; then
@@ -141,19 +141,25 @@ if [ "${#}" -ge "1" ]; then
141
141
142
142
# Terraform < 0.12
143
143
if [ " ${1} " = " terraform-docs" ]; then
144
+ >&2 echo " ${* } "
144
145
exec " ${@ } "
145
146
146
147
# Terraform >= 0.12
147
148
else
148
- mkdir -p /tmp-012
149
- awk -f /terraform-docs.awk -- * .tf > " /tmp-012/tmp.tf"
150
149
151
- # Remove last argument (path)
150
+ # Store and Remove last argument (filename)
151
+ eval MY_DIR=" \$ {$# }" # store last argument
152
152
args=" $( trim_last_arg " ${@ } " ) " # get all the args except the last arg
153
153
eval " set -- ${args} " # update the shell's arguments with the new value
154
- # Remove first argument (terraform-docs-012)
154
+
155
+ mkdir -p /tmp-012
156
+ awk -f /terraform-docs.awk -- " ${MY_DIR} /" * .tf > " /tmp-012/tmp.tf"
157
+
158
+ # Remove first argument
155
159
shift
160
+
156
161
# Execute
162
+ >&2 echo " terraform-docs ${* } ${MY_DIR} "
157
163
if ! terraform-docs " ${@ } " " /tmp-012/" ; then
158
164
cat -n " /tmp-012/tmp.tf" >&2
159
165
exit 1
Original file line number Diff line number Diff line change 1
- # Test
2
-
3
- Stuff before terraform-docs
4
-
5
- <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6
1
7
2
## Inputs
8
3
144
139
| this_security_group_owner_id | The owner ID |
145
140
| this_security_group_vpc_id | The VPC ID |
146
141
147
- <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
148
-
149
- Stuff after terraform-docs
Original file line number Diff line number Diff line change 1
- <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2
1
3
2
## Inputs
4
3
5
4
| Name | Description | Type | Default | Required |
6
5
| ------| -------------| :----:| :-----:| :-----:|
7
6
| test | test description | string | - | yes |
8
7
9
- <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Original file line number Diff line number Diff line change 1
- # Test
2
-
3
- Stuff before terraform-docs
4
-
5
- <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6
1
7
2
## Inputs
8
3
@@ -89,6 +84,3 @@ Stuff before terraform-docs
89
84
| this_db_subnet_group_arn | The ARN of the db subnet group |
90
85
| this_db_subnet_group_id | The db subnet group id |
91
86
92
- <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
93
-
94
- Stuff after terraform-docs
You can’t perform that action at this time.
0 commit comments