Skip to content
forked from abourget/ledger

Golang parser for Ledger files - with ledgerfmt, akin to gofmt.

License

Notifications You must be signed in to change notification settings

cschomburg/ledger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Coverage API Documentation BSD License

Go Ledger

This is a fork of the excellent ledger parser of abourget that fixes a few issues and aims to provides a high-level API to interact with Ledger files.

The underlying library can parse relatively complex Ledger files, and provide an abstract syntax tree (a full programmatic representation of the file), to be able to tweak some parts programmatically, and then write back the files to disk.

  • ledger-go provides a few tools to interact with Ledger files, such as balance reports.

  • ledgerfmt, similar to gofmt, parses the input file, indents and aligns according to conventions, and outputs the file back, without any semantic changes or interpretation of the data.

  • ledger2json parses your Ledger file and outputs a .json file, which you can manipulate with any software.

Installation

go get -u github.com/xconstruct/ledger/cmd/...

Shortcomings

This implementation has a few limitations compared to the C++ version:

  • It does not yet support all top-level constructs, like "account", "alias", "P", "D", "year" / "Y", etc.. Most of those should be simple to implement.
  • It does not yet understand tags. They are only considered comments.
  • It does not yet implement the value_expr language that allows you to do complex math computations directly in the postings of your transactions. It merely store the string text of the expression, PROVIDED it is enclosed in parenthesis, e.g. (123 + 2 * 3 USD).
  • Also note that the current implementation does not validate any balances. It merely acts on the text of the file.

About

Golang parser for Ledger files - with ledgerfmt, akin to gofmt.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%