1 unstable release
Uses new Rust 2024
| new 0.4.0 | Dec 28, 2025 |
|---|
#141 in Value formatting
21KB
340 lines
ledgible
Formatter for ledger and hledger journals. This is not ready for production use.
Currently, I'm only testing against hledger's standard since it is what I personally use. Once it's complete, I'll verify compatibility with ledger's specification.
Rust version 1.89.0 or later is required to compile.
Installation
After installing rustup,
cargo install ledgible
or, for the development version,
cargo install ledgible --git https://git.sr.ht/~eleanor/ledgible --branch main
Options
Formatter for ledger and hledger journals
Usage: ledgible [OPTIONS] [FILE]
Arguments:
[FILE] Input journal
Options:
-o, --output <FILE> Write formatted journal to file
-i, --inplace (DANGEROUS) Overwrite input file
-e, --env Read journal from $LEDGER_FILE
-c, --check Check whether journal is formatted properly
-h, --help Print help
-V, --version Print version
Contributing
All contributions shall be licensed under GPLv3 or later, except to comply with
the license of an existing file in the repository or with the permission of the
project maintainer. The ./commit.sh script in the repository should be run in
order to ensure the commit meets expectations.
./commit.sh Requirements
Installation steps will vary from platform to platform. Assuming rustup is
installed, the other requirements can be installed with something like the
following:
cargo install cargo-msrv
rustup component add clippy
rustup component add rustfmt
npm install -g markdownlint-cli
Both rustup and markdownlint-cli are available via package managers such as
Homebrew or
pacman.
Roadmap
In no particular order:
- Add tests
- Remove extra spaces between amount and currency
- Sort postings to be consistent across transactions
- Align posting amounts to decimal place
- Handle negative sign on other side of currency
- Parse numbers with spaces in them (e.g. $10 000 or $- 100)
- Fully conform to ledger journal standard
- Standardize dates
- Per-currency/commodity formatting
- Expand tabs
- Parse split amounts for improved formatting
- Use user preference for
,versus.in numbers - Remove empty lines at top of journal
- Remove trailing empty lines
- Write output to file
- Read from stdin by default
- Standardize split amounts
Dependencies
~1–2.8MB
~50K SLoC