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

Build from Source

Alternatively, clone this repo and do the following:

Usage

rust_ledger -f LEDGER_FILE_PATH COMMAND -o OPTION

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

RLEDGER_FILE=~/rledger.yaml rust_ledger balances

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

export RLEDGER_FILE="$HOME/rledger.yaml"

COMMAND - ledger command (account, balance, register, or csv)

OPTION (denoted by -o) - allows you to filter the output of the register command by account type. For example, if you wish to only see "expense" transactions in the output, you would pass in expense as the option here.

GROUP (denoted by -g) - allows you to group the output of the register command by year or month.

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

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

```

Account Balance

asset asset:cashchecking $ -700.00
asset:cash
savings $ 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
```

```

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 ```

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: - the account field should be expressed in the following format: account_classification:account_name. - the amount field should be a number. It can include up to two (2) decimal points.
- the date field should be in the following format: YYYY-MM-DD.