mirror of
https://github.com/vale981/apheleia
synced 2025-03-05 09:31:40 -05:00
Use hclfmt to format hashicorp HCL files. (#231)
Add formatter `hclfmt` for Hashicorp Configuration Langauge (HCL).
This commit is contained in:
parent
f4157e8c39
commit
5bade7a734
5 changed files with 26 additions and 0 deletions
|
@ -29,6 +29,7 @@ The format is based on [Keep a Changelog].
|
||||||
`apheleia-mode-alist` ([#191]).
|
`apheleia-mode-alist` ([#191]).
|
||||||
* Autoload the apheleia-goto-error command ([#215]).
|
* Autoload the apheleia-goto-error command ([#215]).
|
||||||
* Use `lisp-indent` as default formatter for `emacs-lisp-mode` ([#223])
|
* Use `lisp-indent` as default formatter for `emacs-lisp-mode` ([#223])
|
||||||
|
* Use `hclfmt` for formatting hashicorp HCL files ([#231])
|
||||||
|
|
||||||
### Internal Changes
|
### Internal Changes
|
||||||
* Refactored the organisation of the apheleia package for ease of
|
* Refactored the organisation of the apheleia package for ease of
|
||||||
|
@ -71,6 +72,7 @@ The format is based on [Keep a Changelog].
|
||||||
* [`rufo`](https://github.com/ruby-formatter/rufo) for
|
* [`rufo`](https://github.com/ruby-formatter/rufo) for
|
||||||
[Ruby](https://www.ruby-lang.org/en/) ([#177]).
|
[Ruby](https://www.ruby-lang.org/en/) ([#177]).
|
||||||
* [`yapf`](https://github.com/google/yapf) for [Python](https://www.python.org/) ([#196])
|
* [`yapf`](https://github.com/google/yapf) for [Python](https://www.python.org/) ([#196])
|
||||||
|
* [`hclfmt`](https://github.com/hashicorp/hcl/tree/main/cmd/hclfmt) for [HCL](https://github.com/hashicorp/hcl) ([#231])
|
||||||
|
|
||||||
[#168]: https://github.com/radian-software/apheleia/pull/168
|
[#168]: https://github.com/radian-software/apheleia/pull/168
|
||||||
[#169]: https://github.com/radian-software/apheleia/pull/169
|
[#169]: https://github.com/radian-software/apheleia/pull/169
|
||||||
|
@ -91,6 +93,7 @@ The format is based on [Keep a Changelog].
|
||||||
[#214]: https://github.com/radian-software/apheleia/pull/214
|
[#214]: https://github.com/radian-software/apheleia/pull/214
|
||||||
[#215]: https://github.com/radian-software/apheleia/pull/215
|
[#215]: https://github.com/radian-software/apheleia/pull/215
|
||||||
[#223]: https://github.com/radian-software/apheleia/pull/223
|
[#223]: https://github.com/radian-software/apheleia/pull/223
|
||||||
|
[#231]: https://github.com/radian-software/apheleia/pull/231
|
||||||
|
|
||||||
## 3.2 (released 2023-02-25)
|
## 3.2 (released 2023-02-25)
|
||||||
### Features
|
### Features
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
(gofumpt . ("gofumpt"))
|
(gofumpt . ("gofumpt"))
|
||||||
(goimports . ("goimports"))
|
(goimports . ("goimports"))
|
||||||
(google-java-format . ("google-java-format" "-"))
|
(google-java-format . ("google-java-format" "-"))
|
||||||
|
(hclfmt . ("hclfmt"))
|
||||||
(html-tidy "tidy"
|
(html-tidy "tidy"
|
||||||
"--quiet" "yes"
|
"--quiet" "yes"
|
||||||
"--tidy-mark" "no"
|
"--tidy-mark" "no"
|
||||||
|
@ -237,6 +238,7 @@ rather than using this system."
|
||||||
(go-ts-mode . gofmt)
|
(go-ts-mode . gofmt)
|
||||||
(graphql-mode . prettier-graphql)
|
(graphql-mode . prettier-graphql)
|
||||||
(haskell-mode . brittany)
|
(haskell-mode . brittany)
|
||||||
|
(hcl-mode . hclfmt)
|
||||||
(html-mode . prettier-html)
|
(html-mode . prettier-html)
|
||||||
(html-ts-mode . prettier-html)
|
(html-ts-mode . prettier-html)
|
||||||
(java-mode . google-java-format)
|
(java-mode . google-java-format)
|
||||||
|
|
3
test/formatters/installers/hclfmt.bash
Normal file
3
test/formatters/installers/hclfmt.bash
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
apt-get install -y golang-go
|
||||||
|
go install github.com/hashicorp/hcl/v2/cmd/hclfmt@latest
|
||||||
|
cp -L "$HOME/go/bin/hclfmt" /usr/local/bin/
|
9
test/formatters/samplecode/hclfmt/in.hcl
Normal file
9
test/formatters/samplecode/hclfmt/in.hcl
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
block {
|
||||||
|
whatever = 1
|
||||||
|
format = "iam in"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars = {
|
||||||
|
equals = "needs"
|
||||||
|
aligned = "properly"
|
||||||
|
}
|
9
test/formatters/samplecode/hclfmt/out.hcl
Normal file
9
test/formatters/samplecode/hclfmt/out.hcl
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
block {
|
||||||
|
whatever = 1
|
||||||
|
format = "iam in"
|
||||||
|
}
|
||||||
|
|
||||||
|
vars = {
|
||||||
|
equals = "needs"
|
||||||
|
aligned = "properly"
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue