From 9f853addd1fdb44966eaaf904114542061a38c5b Mon Sep 17 00:00:00 2001 From: Wynn Wolf Arbor Date: Tue, 10 Mar 2020 17:37:03 +0100 Subject: Replace AlignCommodity with bean-format AlignCommodity replicates the functionality of the bean-format command that is shipped with beancount itself. Therefore, we can fully replace it by having vim invoke bean-format through formatprg. Even though bean-format's output might differ from AlignCommodity in significant ways, we feel that using one unified tool is superior to having several (possibly incompatible) custom implementations. That way, if bean-format is improved upon in the future, all downstream consumers profit. For regular usage, however, this change should be transparent. Note that while bean-format supports a few different ways of formatting the ledger, we have opted to hard-code one specific setting. This will match the default behaviour of fava, aligning currencies in column 61. Managing the arguments passed to bean-format dynamically is considered out of scope, especially given the fact that the user need only override formatprg to get a custom setting. This commit will also drop the g:beancount_separator_col variable and the tests for AlignCommodity. Ideally, testing will now done upstream for bean-format itself. --- test/align.vader | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 test/align.vader (limited to 'test/align.vader') diff --git a/test/align.vader b/test/align.vader deleted file mode 100644 index db6563e..0000000 --- a/test/align.vader +++ /dev/null @@ -1,45 +0,0 @@ -Given beancount: - 2012-12-12 balance Assets:LongLongLongAccount 50.00 - 2012-12-12 balance Assets:Cash 50.00 - 2012-12-12 balance Assets:Cash -50.00 - 2012-12-12 balance Assets:Cash +50.00 - 2012-12-12 price EUR 50.00 USD - metadata: 50 - Assets:Cash 50 - Assets:Cash 50.00 - ! Assets:Cash 50.00 - Assets:Cash 50.00 - Assets:Cash 50.00 USD - -Execute (align): - %AlignCommodity - -Expect beancount: - 2012-12-12 balance Assets:LongLongLongAccount 50.00 - 2012-12-12 balance Assets:Cash 50.00 - 2012-12-12 balance Assets:Cash -50.00 - 2012-12-12 balance Assets:Cash +50.00 - 2012-12-12 price EUR 50.00 USD - metadata: 50 - Assets:Cash 50 - Assets:Cash 50.00 - ! Assets:Cash 50.00 - Assets:Cash 50.00 - Assets:Cash 50.00 USD - -Execute (change alignment column and align again): - let g:beancount_separator_col=40 - %AlignCommodity - -Expect beancount: - 2012-12-12 balance Assets:LongLongLongAccount 50.00 - 2012-12-12 balance Assets:Cash 50.00 - 2012-12-12 balance Assets:Cash -50.00 - 2012-12-12 balance Assets:Cash +50.00 - 2012-12-12 price EUR 50.00 USD - metadata: 50 - Assets:Cash 50 - Assets:Cash 50.00 - ! Assets:Cash 50.00 - Assets:Cash 50.00 - Assets:Cash 50.00 USD -- cgit v1.2.3-2-gb3c3