Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typo in arg name for terraform-docs #283

Merged
merged 4 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Unlike most other hooks, this hook triggers once if there are any changed files
- id: terraform_docs
args:
- --hook-config=--path-to-file=README.md # Valid UNIX path. I.e. ../TFDOC.md or docs/README.md etc.
- --hook-config=--add-to-exiting-file=true # Boolean. true or false
- --hook-config=--add-to-existing-file=true # Boolean. true or false
- --hook-config=--create-file-if-not-exist=true # Boolean. true or false
```

Expand Down
10 changes: 5 additions & 5 deletions terraform_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ terraform_docs() {
# Get hook settings
#
local text_file="README.md"
local add_to_exiting=false
local add_to_existing=false
local create_if_not_exist=false

configs=($hook_config)
Expand All @@ -132,8 +132,8 @@ terraform_docs() {
--path-to-file)
text_file=$value
;;
--add-to-exiting-file)
add_to_exiting=$value
--add-to-existing-file|--add-to-exiting-file) # Typo left for compatibility. Will be removed in 2.0.0.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonbabenko just said that we don't need such greater backward compatibility, so...

Suggested change
--add-to-existing-file|--add-to-exiting-file) # Typo left for compatibility. Will be removed in 2.0.0.
--add-to-existing-file)

Copy link
Collaborator

@yermulnik yermulnik Nov 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonbabenko just said that we don't need such greater backward compatibility, so...

IMHO, it's not about we or need. It's about being polite and careful about consumers by adhering to semver. As such we could have had this "quirk" removed within future 2.0.0 release (alongside announcing this backward incompatible change among others). IMHO.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 3 users (including Maxym) of this argument (GitHub code search) :) In general, I agree that we need to keep compatibility.

add_to_existing=$value
;;
--create-file-if-not-exist)
create_if_not_exist=$value
Expand Down Expand Up @@ -171,10 +171,10 @@ terraform_docs() {
[[ ! -f "$text_file" ]] && popd > /dev/null && continue

#
# If `--add-to-exiting-file=true` set, check is in file exist "hook markers",
# If `--add-to-existing-file=true` set, check is in file exist "hook markers",
# and if not - append "hook markers" to the end of file.
#
if $add_to_exiting; then
if $add_to_existing; then
HAVE_MARKER=$(grep -o '<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->' "$text_file" || exit 0)

if [ ! "$HAVE_MARKER" ]; then
Expand Down