Skip to content

Commit 8a70371

Browse files
authored
feat: add opentofu-fmt formatter (#136)
1 parent 60f5f80 commit 8a70371

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
local h = require("null-ls.helpers")
2+
local methods = require("null-ls.methods")
3+
4+
local FORMATTING = methods.internal.FORMATTING
5+
6+
return h.make_builtin({
7+
name = "opentofu_fmt",
8+
meta = {
9+
url = "https://opentofu.org/docs/cli/commands/fmt/#usage",
10+
description = "The opentofu-fmt command rewrites `opentofu` configuration files to a canonical format and style.",
11+
},
12+
method = FORMATTING,
13+
filetypes = { "terraform", "tf", "terraform-vars" },
14+
generator_opts = {
15+
command = "tofu",
16+
args = {
17+
"fmt",
18+
"-",
19+
},
20+
to_stdin = true,
21+
},
22+
factory = h.formatter_factory,
23+
})

0 commit comments

Comments
 (0)