diff --git a/examples/hledger2beancount.conf b/examples/hledger2beancount.conf index 574dafda5..d5f888a2c 100755 --- a/examples/hledger2beancount.conf +++ b/examples/hledger2beancount.conf @@ -1,18 +1,24 @@ # 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 +# 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. ---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] -O beancount # Exclude transactions containing unbalanced/virtual postings. # You might need to do more if you have mixed balanced/unbalanced transactions. --real - -# More tips: https://hledger.org/dev/hledger.html#beancount-output diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 3b4d5ffbc..a365d2720 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -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. Here are those commands and the formats currently supported: -| command | txt | html | csv, tsv | fods | beancount | sql | json | -|--------------------|-----|------|----------|------|-----------|-----|------| -| aregister | Y | Y | Y | | | | Y | -| balance | Y | Y | Y | Y | | | Y | -| balancesheet | Y | Y | Y | | | | Y | -| balancesheetequity | Y | Y | Y | | | | Y | -| cashflow | Y | Y | Y | | | | Y | -| incomestatement | Y | Y | Y | | | | Y | -| print | Y | | Y | | Y | Y | Y | -| register | Y | | Y | | | | Y | +| command | txt | html | csv/tsv | fods | beancount | sql | json | +|--------------------|-----|------|---------|------|-----------|-----|------| +| aregister | Y | Y | Y | | | | Y | +| balance | Y | Y | Y | Y | | | Y | +| balancesheet | Y | Y | Y | | | | Y | +| balancesheetequity | Y | Y | Y | | | | Y | +| cashflow | Y | Y | Y | | | | Y | +| incomestatement | Y | Y | Y | | | | Y | +| print | Y | | Y | | Y | Y | Y | +| register | Y | | Y | | | | Y | +possibly stored in a [config file](#config-file). +(Example: [hledger2beancount.conf](https://github.com/simonmichael/hledger/blob/master/examples/hledger2beancount.conf)) 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. -Transactions containing only virtual postings can be excluded easily with `--real`. -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. `--real` may be enough +(though, not if you have transactions which are a mixture of balanced and unbalanced postings). [Beancount]: https://beancount.github.io [beancount journal]: https://beancount.github.io/docs/beancount_language_syntax.html