From 307afa95499e7e3ed58a76a2818b1dc3ce11f9d5 Mon Sep 17 00:00:00 2001 From: John Goff Date: Sat, 5 Oct 2024 19:57:58 -0400 Subject: [PATCH] [#309] Write beancount files to disk before formatting (#310) Fixes #309 The `bean-format` tool reads a file from the filename passed on the command line, then outputs the formatted file to `STDOUT`. The filename passed on the command line is a requirement, the `bean-format` tool does not read from `STDIN` at all. Another option would be to use `("bean-format" input "-o" output)`, but this way apheleia can avoid an extra file read that's not strictly necessary. --------- Co-authored-by: Radon Rosborough --- CHANGELOG.md | 2 ++ apheleia-formatters.el | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbbc873..7709f62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog]. * `mix format` is now passed the `--stdin-filename` argument which is required in some cases. The version of Mix is autodetected and this option is only passed when it is supported ([#319]). +* Beancount files are formatted without an error ([#309]). ## Internal * Improvements to formatter test framework, it is now possible to @@ -37,6 +38,7 @@ The format is based on [Keep a Changelog]. [#301]: https://github.com/radian-software/apheleia/pull/301 [#306]: https://github.com/radian-software/apheleia/pull/306 +[#309]: https://github.com/radian-software/apheleia/issues/309 [#312]: https://github.com/radian-software/apheleia/issues/312 [#313]: https://github.com/radian-software/apheleia/pull/313 [#316]: https://github.com/radian-software/apheleia/pull/316 diff --git a/apheleia-formatters.el b/apheleia-formatters.el index ec3d83b..77e07ef 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -24,7 +24,7 @@ '((astyle . ("astyle" (apheleia-formatters-locate-file "--options" ".astylerc"))) (asmfmt . ("asmfmt")) - (bean-format . ("bean-format")) + (bean-format . ("bean-format" input)) (beautysh . ("beautysh" (apheleia-formatters-indent "--tab" "--indent-size" 'sh-basic-offset)