;doc: beancount output doc/conf file updates

This commit is contained in:
Simon Michael 2024-10-03 23:35:36 -10:00
parent 8c71d071d7
commit a248cc5bc8
2 changed files with 27 additions and 37 deletions

View File

@ -1,18 +1,24 @@
# This config file works with hledger 1.40+ and helps export to Beancount format. # This config file works with hledger 1.40+ and helps export to Beancount format.
# You don't need to use a config file for this, but it might be convenient.
# Usage: hledger --conf hledger2beancount.conf print [-f FILE] >FILE.beancount # Usage: hledger --conf hledger2beancount.conf print [-f FILE] >FILE.beancount
# You don't need to use a config file for this, but it might be convenient.
# See also: https://hledger.org/dev/hledger.html#beancount-output
# Whatever aliases you need, if any, to provide the english top-level account names required by Beancount. # Whatever aliases you need, if any, to provide the english top-level account names required by Beancount.
--alias /^([^:]+):([^:]+)/=\2:\1
--alias other-assets=assets
--alias revenues=income
[print] # Simple aliases:
--alias actifs=assets
--alias passifs=liabilities
--alias 'capitaux propres'=equity
--alias revenus=income
--alias dépenses=expenses
# A regex alias that moves the level 2 names up to level 1:
# --alias /^([^:]+):([^:]+)/=\2:\1
# Print beancount output by default. # Print beancount output by default.
[print]
-O beancount -O beancount
# Exclude transactions containing unbalanced/virtual postings. # Exclude transactions containing unbalanced/virtual postings.
# You might need to do more if you have mixed balanced/unbalanced transactions. # You might need to do more if you have mixed balanced/unbalanced transactions.
--real --real
# More tips: https://hledger.org/dev/hledger.html#beancount-output

View File

@ -610,16 +610,16 @@ $ hledger print -o - # write to stdout (the default)
Some commands offer other kinds of output, not just text on the terminal. Some commands offer other kinds of output, not just text on the terminal.
Here are those commands and the formats currently supported: Here are those commands and the formats currently supported:
| command | txt | html | csv, tsv | fods | beancount | sql | json | | command | txt | html | csv/tsv | fods | beancount | sql | json |
|--------------------|-----|------|----------|------|-----------|-----|------| |--------------------|-----|------|---------|------|-----------|-----|------|
| aregister | Y | Y | Y | | | | Y | | aregister | Y | Y | Y | | | | Y |
| balance | Y | Y | Y | Y | | | Y | | balance | Y | Y | Y | Y | | | Y |
| balancesheet | Y | Y | Y | | | | Y | | balancesheet | Y | Y | Y | | | | Y |
| balancesheetequity | Y | Y | Y | | | | Y | | balancesheetequity | Y | Y | Y | | | | Y |
| cashflow | Y | Y | Y | | | | Y | | cashflow | Y | Y | Y | | | | Y |
| incomestatement | Y | Y | Y | | | | Y | | incomestatement | Y | Y | Y | | | | Y |
| print | Y | | Y | | Y | Y | Y | | print | Y | | Y | | Y | Y | Y |
| register | Y | | Y | | | | Y | | register | Y | | Y | | | | Y |
<!-- <!--
| accounts | | | | | | | accounts | | | | | |
@ -704,28 +704,12 @@ hledger will mostly adapt your account names to the more restricted
But you must ensure that the top level account names are `Assets`, `Liabilities`, `Equity`, `Income`, and `Expenses`. But you must ensure that the top level account names are `Assets`, `Liabilities`, `Equity`, `Income`, and `Expenses`.
If yours are different, you can use [account aliases](#alias-directive), usually in the form of `--alias` options, If yours are different, you can use [account aliases](#alias-directive), usually in the form of `--alias` options,
possibly stored in a [config file](#config-file). For example, possibly stored in a [config file](#config-file).
(Example: [hledger2beancount.conf](https://github.com/simonmichael/hledger/blob/master/examples/hledger2beancount.conf))
```conf
--alias actifs=assets
--alias passifs=liabilities
--alias 'capitaux propres'=equity
--alias revenus=income
--alias dépenses=expenses
```
<!--
If you use entity names as your top accounts: here's a more complex alias that moves the level 2 names up to level 1:
```
--alias /^([^:]+):([^:]+)/=\2:\1
```
-->
Finally, you will also need to exclude any transactions that use [unbalanced/virtual postings](#virtual-postings). Finally, you will also need to exclude any transactions that use [unbalanced/virtual postings](#virtual-postings).
Beancount doesn't allow those, but some hledger and Ledger users use them occasionally. We don't automate this, to avoid surprises. `--real` may be enough
Transactions containing only virtual postings can be excluded easily with `--real`. (though, not if you have transactions which are a mixture of balanced and unbalanced postings).
Transactions which are a mixture of balanced and unbalanced postings will need to be excluded by some other method.
<!-- (We don't automate this, to avoid surprises.) -->
[Beancount]: https://beancount.github.io [Beancount]: https://beancount.github.io
[beancount journal]: https://beancount.github.io/docs/beancount_language_syntax.html [beancount journal]: https://beancount.github.io/docs/beancount_language_syntax.html