mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
fix: remove sed postprocessing from the terraform_docs_replace hook to fix compatibility with terraform-docs 0.11.0+ (#176)
This commit is contained in:
parent
ad5dccae65
commit
90d45213a3
2 changed files with 4 additions and 4 deletions
|
|
@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
||||||
<a name="unreleased"></a>
|
<a name="unreleased"></a>
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- fix: Removes sed post-processing from the `terraform_docs_replace` hook which was causing the last line to be missing when using `terraform-docs` 0.11.0+. Note: for older versions this change will result in an extra newline at the end of the file (making the pre-commit hook and `terraform-docs` output identical).
|
||||||
|
|
||||||
|
|
||||||
<a name="v1.46.0"></a>
|
<a name="v1.46.0"></a>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ def main(argv=None):
|
||||||
|
|
||||||
dirs = []
|
dirs = []
|
||||||
for filename in args.filenames:
|
for filename in args.filenames:
|
||||||
if (os.path.realpath(filename) not in dirs and \
|
if (os.path.realpath(filename) not in dirs and
|
||||||
(filename.endswith(".tf") or filename.endswith(".tfvars"))):
|
(filename.endswith(".tf") or filename.endswith(".tfvars"))):
|
||||||
dirs.append(os.path.dirname(filename))
|
dirs.append(os.path.dirname(filename))
|
||||||
|
|
||||||
|
|
@ -43,9 +43,8 @@ def main(argv=None):
|
||||||
procArgs.append('--sort-by-required')
|
procArgs.append('--sort-by-required')
|
||||||
procArgs.append('md')
|
procArgs.append('md')
|
||||||
procArgs.append("./{dir}".format(dir=dir))
|
procArgs.append("./{dir}".format(dir=dir))
|
||||||
procArgs.append("| sed -e '$ d' -e 'N;/^\\n$/D;P;D'")
|
|
||||||
procArgs.append('>')
|
procArgs.append('>')
|
||||||
procArgs.append("./{dir}/{dest}".format(dir=dir,dest=args.dest))
|
procArgs.append("./{dir}/{dest}".format(dir=dir, dest=args.dest))
|
||||||
subprocess.check_call(" ".join(procArgs), shell=True)
|
subprocess.check_call(" ".join(procArgs), shell=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue