Skip to content

Commit 1cbab1e

Browse files
committed
fix(terraform-docs): follow suggestion for trimming of additional arguments in args string
1 parent 3adde17 commit 1cbab1e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hooks/terraform_docs.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ function terraform_docs {
145145
had_config_flag=true
146146
local config_file=${args#*--config}
147147
config_file=${config_file#*=}
148-
config_file=${config_file% --*}
149-
args=${args/--config=$config_file/}
148+
# If there are more parameters after config path, trim until --
149+
if [[ $config_file == *" --"* ]]; then
150+
config_file=${config_file%% --*}
151+
fi
152+
# Trim trailing whitespace but preserve internal spaces
153+
154+
config_file="${config_file%"${config_file##*[![:space:]]}"}" args=${args/--config=$config_file/}
150155

151156
# Prioritize `.terraform-docs.yml` `output.file` over
152157
# `--hook-config=--path-to-file=` if it set

0 commit comments

Comments
 (0)