#ledger #accounting #plain-text-accounting #ledger-cli #csv #format-file #import

bin+lib okane

CLI tool to support Ledger (https://www.ledger-cli.org/) equivalent syntax files

17 releases (11 breaking)

0.13.0 Oct 28, 2024
0.11.0 Aug 7, 2024
0.10.0 Jul 5, 2024
0.8.0 Feb 3, 2024
0.1.0 Nov 26, 2021

#27 in Finance

40 downloads per month

MIT license

420KB
11K SLoC

okane

CircleCI crates.io

Okane is a plain text accounting software developed with Rust, influenced by ledger-cli.

This tool supports various commands:

  • balance to get the current balance of the accounts.
  • register to get the history of the accounts.
  • accounts to list all accounts in the file.
  • format to format given Ledger file into organized format.
  • import to convert various source including CSV, ISO Camt053 XML into Ledger format.
  • primitive to hold commands that are not so useful but good for debugging.

Note balance, register are still work-in-progress, and the UX would change drastically.

How to use

Disclaimer: This software is still in early phase, subject to any kind of change.

Follows syntax page for the supported syntax.

Install

Up until now no binary release is provided, so you need to run cargo install to install the tool.

$ cargo install okane

Query the file

Similar to Ledger, you can use similar commands.

$ okane accounts /path/to/file.ledger
$ okane balance /path/to/file.ledger
$ okane registry /path/to/file.ledger [optional account]

Format the file

$ okane format ~/ledger/account.ledger

This command currently prints the formatted output into standard output. In future in-place format would be provided, also to emit diffs to be used as Git hook.

Import CSV or ISO Camt053 XML files

First you need to write YAML file to control import behavior. We'll assume those are placed under ~/ledger/. The format of YAML is (sorry) not documented, but you can see tests/testdata directory as example configurations.

Then run the okane import command with logging and redirecting to /dev/null. This way you can dry-run and check its output.

$ RUST_LOG=info okane import --config ~/ledger/import.yml ~/ledger/input_file.csv > /dev/null

After iterating over the logs and modifying YAML file, you can redirect the standard output to the ledger file.

$ RUST_LOG=info okane import --config ~/ledger/import.yml ~/ledger/input_file.csv >> ~/ledger/output_path.ledger

Tips: You probably don't want to handle all the entries, rather should aim to cover 80-90% of entries initially.

License

This tool is licensed under MIT lisence.

Dependencies

~18MB
~367K SLoC