From 15c9f394d32708ad3d2735af9c73cb03a6bad1af Mon Sep 17 00:00:00 2001 From: rothandrew Date: Fri, 14 Dec 2018 17:03:14 -0500 Subject: [PATCH] Fix bug not letting terraform_docs_replace work in the root directory of a repo --- pre_commit_hooks/terraform_docs_replace.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pre_commit_hooks/terraform_docs_replace.py b/pre_commit_hooks/terraform_docs_replace.py index 7e3bc2fb8..05fec622e 100644 --- a/pre_commit_hooks/terraform_docs_replace.py +++ b/pre_commit_hooks/terraform_docs_replace.py @@ -25,7 +25,6 @@ def main(argv=None): dirs = [] for filename in args.filenames: if (os.path.realpath(filename) not in dirs and \ - len(os.path.realpath(filename).strip()) > 0 and \ (filename.endswith(".tf") or filename.endswith(".tfvars"))): dirs.append(os.path.dirname(filename)) @@ -40,7 +39,7 @@ def main(argv=None): if args.aggregate: procArgs.append('--with-aggregate-type-defaults') procArgs.append('md') - procArgs.append(dir) + procArgs.append("./{dir}".format(dir=dir)) procArgs.append("| sed -e '$ d' -e 'N;/^\\n$/D;P;D'") procArgs.append('>') procArgs.append("./{dir}/{dest}".format(dir=dir,dest=args.dest))