Latest version Documentation

rust_ledger

command line accounting tool

As a former CPA, I could not resist building my own accounting system.

Summary

Contributing

Install

From Cargo

cargo install rust_ledger

Binaries for Linux, macOS, and Windows

We distribute binaries for the above platforms. See releases for a complete list by version.

Additionally, we currently ship binaries through the following package managers:

Build from Source

Alternatively, clone this repo and do the following:

Usage

rust_ledger --help will provide a menu of all available commands and optional arguments.

```bash rust_ledger Eric Crowder ebcrowder@gmail.com

USAGE: rust_ledger [SUBCOMMAND]

FLAGS: -h, --help Prints help information -V, --version Prints version information

SUBCOMMANDS: account account module balance balance module csv csv module help Prints this message or the help of the given subcommand(s) register register module ```

rust_ledger COMMAND -f LEDGER_FILE_PATH

LEDGERFILEPATH (denoted by -f) - relative path to location of yaml ledger file

RLEDGER_FILE=~/rledger.yaml rust_ledger balance

RLEDGER_FILE can be set as a system or user environment variable.

export RLEDGER_FILE=$HOME/rledger.yaml

Environment Variables

RLEDGER_FILE - Path to rledger file. ex: RLEDGER_FILE=~/rledger.yaml

NO_COLOR - Disables color output. ex: NO_COLOR=true

Features

Transactions

Transactions can be expressed in two different ways. One is a "simplified" format for transactions that only impact two accounts:

yaml - date: 2020-01-01 amount: 200 offset_account: liability:credit_card_amex description: grocery store account: expense:expense_general

The sign (debit / credit) associated with the offset_account value is the opposite of the sign of the value contained in amount field.

In the above example transaction, since expense_general was debited by 200, the credit_card_amex account will be credited by the same amount.

Transactions that involve more than two accounts are expressed in the following manner:

yaml - date: 2020-01-01 description: grocery store transactions: - amount: 20 account: expense:general - amount: 180 account: expense:grocery - amount: -200 account: liability:credit_card_amex

Transactions that only involve two accounts can also be expressed in the above format.

Test

API

account

``` rust_ledger-account account module

USAGE: rust_ledger account [OPTIONS]

FLAGS: -h, --help Prints help information -V, --version Prints version information

OPTIONS: -f, --filename location of ledger file ```

```

Account

asset:cashchecking asset:cashsavings liability:creditcardamex equity:equity expense:grocery expense:general expense:mortgage income:general ```

balance

``` rust_ledger-balance balance module

USAGE: rust_ledger balance [OPTIONS]

FLAGS: -h, --help Prints help information -V, --version Prints version information

OPTIONS: -f, --filename location of ledger file ```

```

Account Balance

asset asset:cashchecking $ -700.00 asset:cashsavings $ 1000.00 liability liability:creditcardamex $ -455.00 equity equity:equity $ -3500.00 expense expense:grocery $ 635.00 expense:general $ 1020.00 expense:mortgage $ 2000.00 income income:general 0


check 0 ```

register

``` rust_ledger-register register module

USAGE: rust_ledger register [OPTIONS]

FLAGS: -h, --help Prints help information -V, --version Prints version information

OPTIONS: -f, --filename location of ledger file -g, --group group register output by value -o, --option

```

Date Description Accounts

2019-12-31 weekly groceries grocery $ 455.00 $ 455.00 creditcardamex $ -455.00 0 2020-01-01 mortage mortgage $ 2000.00 $ 2000.00 cashchecking $ -2000.00 0 2020-01-01 stuff general $ 1000.00 $ 1000.00 cashsavings $ -1000.00 0 2020-01-01 grocery store general $ 20.00 $ 20.00 grocery $ 180.00 $ 200.00 cash_checking $ -200.00 0 ```

csv

``` rust_ledger-csv csv module

USAGE: rust_ledger csv [OPTIONS]

FLAGS: -h, --help Prints help information -V, --version Prints version information

OPTIONS: -c, --csv path of csv file -f, --filename location of ledger file -o, --offset offset account for each csv transaction ```

rust_ledger yaml file format

```yaml accounts: - account: amount:

transactions: - date: amount: description: account: offset_account: - date: description: transactions: - amount: account: - amount: account: ```

The ledger format schema is purposely lightweight. The only requirements are as follows: