Skip to content

vvcephei/scala-ledger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-ledger

A JVM library for reading and writing Ledger data files (http://www.ledger-cli.org/).

I wrote it to support another project of mine, but I'd be happy to maintain it if it's generally useful.

Build

Build Status

compile: sbt compile

test: sbt test

Usage

val ledger: Ledger = LedgerDataFileParser parse Source.fromFile(ledgerFile).getLines()
// the Ledger is a sequence of comments, period transactions, or regular transactions.

val ledgerWriter = LedgerDataFileWriter(ledgerFile, append = true)

try{
ledgerWriter.write(
    LedgerTransaction(
      date = new DateTime(),
      marker = None,
      code = None,
      description = "the descrptions",
      notes = Nil,
      postings = List(
        Posting("Expenses:A", Some(1.0)),
        Posting("Assets:B", Some(-1.0))
      ))
  )
} finally {
  ledgerWriter.close()
}

About

JVM library for reading/writing ledger data files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages