hledger-fmt formats hledger journals. It keeps your
journal ordered by date, and nicely formatted, using hledger print
to format
your transactions.
Prepare the hledger journal file:
- Add a separator line to the journal file:
; :::Transactions:::
- Organize the journal file:
- anything that is not a transaction above the separator line - this part
will not be modified by
hledger-fmt
- all transactions below the separator line - this part will be formatted
by
hledger-fmt
- anything that is not a transaction above the separator line - this part
will not be modified by
Format your journal:
$ hledger-fmt # format $LEDGER_FILE
$ hledger-fmt -f 2021.journal # format 2021.journal
Install hledger-fmt in your PATH. For example go install
if you have
~/go/bin
in your PATH.
Now you can use it as an hledger add-on like so:
$ hledger fmt