hledger-parser

Crates.iohledger-parser
lib.rshledger-parser
version1.0.0-beta.2
sourcesrc
created_at2024-10-27 20:05:38.514833
updated_at2024-11-04 20:25:38.495832
descriptionHledger jornal parser
homepage
repositoryhttps://github.com/ngalaiko/hledger-desktop
max_upload_size
id1424930
size167,492
Nikita Galaiko (ngalaiko)

documentation

README

hledger-parser

Coverage Status crates.io docs.rs License actions-badge

parser for hledger journals powered by chumsky

goals

  • parse plaintext .journals into structured data to build tools on top

non goals

  • re-build hledger in rust

current state

public beta

it's able to parse cheatsheet and my personal ledger (which is quite extensive)

i don't like the api so far, so it will probably change

things i don't like:

  • year directive - it is only used for parsing, probably no reason to export it?
  • decimal mark directive - same thing
  • error messages
  • period::interval type definitions
  • exporting chrono and rust_decimal types. maybe it's better to define own types?

binary

a small binary comes with this lib that i found helpful during development and testing

it takes path to a .journal file, and outputs parse result or parsing error

> cargo run --features cli -- --help
Usage: hledger-parser --ledger-file <LEDGER_FILE>

Options:
      --ledger-file <LEDGER_FILE>  [env: LEDGER_FILE=/path/to/ledger.journal]
  -h, --help                       Print help
Commit count: 74

cargo fmt