Yet another formatter for beancount.
- Deep cleanup.
- Normalizes all spacing.
- Full beancount v2 syntax support (except out-of-line tags / links in
transaction
).
- Currency / cost aligning.
- Works for
open
,balance
,price
and posting.
- Works for
- Entry sorting.
- Honors
pushtag
/pushmeta
. - Honors
time
meta (HH:MM
/HH:MM:SS
/ epoch seconds / epoch ms / epoch us). - Preserves comments.
- Preserves existing structure and ordering whenever possible.
- Honors
- Thousands separator normalization.
- Adds / removes / keeps thousands separators.
- Recursive formatting.
- Recursively formats included files.
- Honors glob includes.
- Flexible output.
- Prints results / prints diff / writes back to file.
- Typed and extensible.
- For example, the code for thousands separators is as simple as this.
pip install autobean-format
# format and print results
autobean-format foo.bean
# format and write back to file
autobean-format foo.bean --output-mode=inplace
# format and print the diff
autobean-format foo.bean --output-mode=diff
# sort entries by date and time
autobean-format foo.bean --sort
# recursively format all included files
autobean-format foo.bean --recursive
# add thousands separators to all numbers
autobean-format foo.bean --thousands-separator=add
# see more options
autobean-format -h
autobean-format foo.bean \
--indent=' ' \
--currency-column=30 \
--cost-column=35 \
--thousands-separator=add \
--spaces-in-braces \
--sort \
--recursive \
--output-mode=inplace
Before | After |
---|---|
|
|