mirror of
https://github.com/numtide/treefmt.git
synced 2024-11-10 15:25:52 +03:00
parent
dc25c5a742
commit
f640dd9c9d
@ -37,6 +37,7 @@ quite tricky.
|
||||
## Usage
|
||||
|
||||
`$ cargo run -- --help`
|
||||
|
||||
```
|
||||
treefmt 0.1.1
|
||||
✨ format all your language!
|
||||
|
@ -16,12 +16,17 @@ packages = [
|
||||
# Code formatters
|
||||
"elmPackages.elm-format",
|
||||
"go",
|
||||
"haskellPackages.ormolu",
|
||||
"haskellPackages.cabal-fmt",
|
||||
"haskellPackages.ormolu",
|
||||
"nixpkgs-fmt",
|
||||
"nodePackages.prettier",
|
||||
"python3.pkgs.black",
|
||||
"shfmt",
|
||||
"terraform",
|
||||
|
||||
"mdbook"
|
||||
]
|
||||
|
||||
[[env]]
|
||||
name = "PATH"
|
||||
eval = "$PWD/target/debug:$PATH"
|
||||
|
@ -125,3 +125,8 @@ options = [
|
||||
]
|
||||
includes = ["*.sh"]
|
||||
```
|
||||
|
||||
## terraform
|
||||
|
||||
terraform fmt only supports formatting one file at the time. See
|
||||
https://github.com/hashicorp/terraform/pull/28191
|
||||
|
4
examples/terraform/main.tf
Normal file
4
examples/terraform/main.tf
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
resource "my_resource" "xxx" {
|
||||
option = [1, 2, 3]
|
||||
}
|
4
examples/terraform/two.tf
Normal file
4
examples/terraform/two.tf
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
resource "other_resource" "xxx" {
|
||||
xxx = "xxx"
|
||||
}
|
6
scripts/terraform-fmt
Executable file
6
scripts/terraform-fmt
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
for path in "$@"; do
|
||||
terraform fmt "$path"
|
||||
done
|
@ -63,3 +63,7 @@ options = [
|
||||
"-w", # write back to the file
|
||||
]
|
||||
includes = ["*.sh"]
|
||||
|
||||
[formatter.terraform]
|
||||
command = "./scripts/terraform-fmt"
|
||||
includes = ["*.tf"]
|
||||
|
Loading…
Reference in New Issue
Block a user