aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEllis KenyƑ <elken@users.noreply.github.com>2022-06-20 22:51:17 +0100
committerGitHub <noreply@github.com>2022-06-20 14:51:17 -0700
commitac6f733d7ba80d6a4d50fa16eae96ad2fee63790 (patch)
tree444ab20e286872f997d0cf8f1c143df994feca67
parent2fa9dd97eddf54fe4fe01449612722399aa05d1c (diff)
Add bean-format (#101)
* feat: add bean-format * fix: apt => apt-get Co-authored-by: Radon Rosborough <radon.neon@gmail.com> * fix: pip => pip3 Co-authored-by: Radon Rosborough <radon.neon@gmail.com> * Update changelog Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
-rw-r--r--CHANGELOG.md5
-rw-r--r--apheleia.el4
-rw-r--r--test/formatters/installers/bean-format.bash2
-rw-r--r--test/formatters/samplecode/bean-format/in.beancount11
-rw-r--r--test/formatters/samplecode/bean-format/out.beancount11
5 files changed, 31 insertions, 2 deletions
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