Skip to content

Commit b1fa507

Browse files
committed
Refactor entry script
1 parent 580f2de commit b1fa507

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

modules/hooks.nix

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3657,26 +3657,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
36573657
name = "terraform-format";
36583658
description = "Format Terraform (`.tf`) files.";
36593659
package = tools.opentofu;
3660-
entry =
3661-
let
3662-
terraform-fmt = pkgs.writeScriptBin "terraform-fmt" ''
3663-
#!/usr/bin/env bash
3664-
3665-
set -euo pipefail
3666-
3667-
print_help() {
3668-
echo "Run '$1 fmt -recursive' to format the code"
3669-
exit 1
3670-
}
3671-
3672-
if [ -f "${hooks.terraform-format.package}/bin/tofu" ]; then
3673-
${hooks.terraform-format.package}/bin/tofu fmt -check -diff "$@" || print_help "tofu"
3674-
else
3675-
${hooks.terraform-format.package}/bin/terraform fmt -check -diff "$@" || print_help "terraform"
3676-
fi
3677-
'';
3678-
in
3679-
"${terraform-fmt}/bin/terraform-fmt";
3660+
entry = "${lib.getExe hooks.terraform-format.package} fmt -check -diff";
36803661
files = "\\.tf$";
36813662
};
36823663
terraform-validate =

0 commit comments

Comments
 (0)