diff --git a/CHANGELOG.md b/CHANGELOG.md index 245fbd1..a59c84e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,12 @@ The format is based on [Keep a Changelog]. * shfmt uses 4 spaces instead of tabs by default. ### Formatters +* [bean-format](https://github.com/beancount/beancount) for Beancount + ([#101]). * [stylua](https://github.com/JohnnyMorganz/StyLua) for Lua ([#105]). -[#105]: https://github.com/raxod502/apheleia/pull/105 +[#101]: https://github.com/radian-software/apheleia/pull/101 +[#105]: https://github.com/radian-software/apheleia/pull/105 ## 3.0 (released 2022-06-01) ### Breaking changes diff --git a/apheleia.el b/apheleia.el index ec8e33c..ce188f7 100644 --- a/apheleia.el +++ b/apheleia.el @@ -919,7 +919,8 @@ being run, for diagnostic purposes." (apply-partially #'kill-buffer scratch))))) (defcustom apheleia-formatters - '((black . ("black" "-")) + '((bean-format . ("bean-format" filepath)) + (black . ("black" "-")) (brittany . ("brittany")) (clang-format . ("clang-format")) (dart-format . ("dart" "format")) @@ -1047,6 +1048,7 @@ function: %s" command))) (defcustom apheleia-mode-alist '(;; php-mode has to come before cc-mode (php-mode . phpcs) + (beancount-mode . bean-format) (cc-mode . clang-format) (c-mode . clang-format) (c++-mode . clang-format) diff --git a/test/formatters/installers/bean-format.bash b/test/formatters/installers/bean-format.bash new file mode 100644 index 0000000..b7de5bb --- /dev/null +++ b/test/formatters/installers/bean-format.bash @@ -0,0 +1,2 @@ +apt-get install -y python3-pip +pip3 install beancount diff --git a/test/formatters/samplecode/bean-format/in.beancount b/test/formatters/samplecode/bean-format/in.beancount new file mode 100644 index 0000000..b7f99b1 --- /dev/null +++ b/test/formatters/samplecode/bean-format/in.beancount @@ -0,0 +1,11 @@ +* Section header +;; Accounts (comments) +2013-01-01 open Expenses:Restaurant +2013-01-01 open Assets:Cash +2014-03-02 * "Something" + Expenses:Restaurant 50.02 USD + Assets:Cash +2014-03-05 balance Assets:Cash -50.02 USD +2014-03-10 * "Something" + Assets:Other 10 HOOL {500.23} USD ; Bla + Assets:Cash diff --git a/test/formatters/samplecode/bean-format/out.beancount b/test/formatters/samplecode/bean-format/out.beancount new file mode 100644 index 0000000..63fc6a6 --- /dev/null +++ b/test/formatters/samplecode/bean-format/out.beancount @@ -0,0 +1,11 @@ +* Section header +;; Accounts (comments) +2013-01-01 open Expenses:Restaurant +2013-01-01 open Assets:Cash +2014-03-02 * "Something" + Expenses:Restaurant 50.02 USD + Assets:Cash +2014-03-05 balance Assets:Cash -50.02 USD +2014-03-10 * "Something" + Assets:Other 10 HOOL {500.23} USD ; Bla + Assets:Cash