Configuration
rustledger can be configured via environment variables, config files, and command-line options.
Environment Variables
| Variable | Description | Example |
|---|---|---|
RLEDGER_FILE | Default beancount file | ~/ledger.beancount |
RLEDGER_PROFILE | Active profile name | business |
NO_COLOR | Disable colored output | 1 |
Set in your shell profile (~/.bashrc, ~/.zshrc):
bash
export RLEDGER_FILE="$HOME/finances/main.beancount"Config File
rustledger looks for configuration in these locations (highest to lowest priority):
.rledger.tomlin the current directory (searching upward)~/.config/rledger/config.toml(user config)/etc/rledger/config.toml(system config, Unix only)
Higher priority configs override lower ones. You can also generate a default config with:
bash
rledger config init # Create user config
rledger config init --project # Create project config (.rledger.toml)
rledger config edit # Open config in editor
rledger config show # Show merged configurationExample Config
toml
# ~/.config/rledger/config.toml
[default]
# Default beancount file
file = "~/finances/main.beancount"
# Editor for interactive commands (defaults to $EDITOR)
# editor = "nvim"
# Command-specific output settings
[commands.query.output]
format = "text"
[commands.report.output]
format = "text"
# Profiles for different ledgers
[profiles.personal]
file = "~/finances/personal.beancount"
[profiles.business]
file = "~/finances/business.beancount"
# Command aliases
[aliases]
bal = "report balances"
is = "report income"
bs = "report balsheet"Using Profiles
bash
# Use a profile
rledger check -P personal
rledger report balances -P business
# Override ledger file
rledger check ~/other/ledger.beancountBeancount Options
Set options in your beancount file:
beancount
option "title" "My Personal Finances"
option "operating_currency" "USD"
option "booking_method" "FIFO"Common Options
| Option | Description | Default |
|---|---|---|
title | Ledger title | (none) |
operating_currency | Main currency | (none) |
booking_method | FIFO, LIFO, AVERAGE, etc. | STRICT |
account_previous_balances | Retained earnings account | Equity:Opening-Balances |
account_current_earnings | Current earnings account | Equity:Earnings:Current |
inferred_tolerance_default | Balance tolerance | 0.005 |
Booking Methods
beancount
; First-in, first-out
option "booking_method" "FIFO"
; Last-in, first-out
option "booking_method" "LIFO"
; Average cost
option "booking_method" "AVERAGE"
; Strict matching (default)
option "booking_method" "STRICT"Shell Aliases
For quick commands, add aliases to your shell:
bash
# ~/.bashrc or ~/.zshrc
export RLEDGER_FILE="$HOME/finances/main.beancount"
# Quick commands
alias rc='rledger check'
alias rq='rledger query'
alias rb='rledger report balances -a'
alias rr='rledger report journal -a'
alias rbal='rledger report balsheet'
alias ris='rledger report income'
# Usage:
# rc - check ledger
# rb Expenses:Food - balance for food expenses
# rr Assets:Bank - register for bank accountsEditor Integration
VS Code
Install the Beancount extension and configure it to use rustledger:
json
{
"beancount.lspPath": "rledger-lsp"
}Neovim
Using nvim-lspconfig:
lua
require('lspconfig').rledger_lsp.setup{}Helix
Add to ~/.config/helix/languages.toml:
toml
[[language]]
name = "beancount"
language-server = { command = "rledger-lsp" }See Editor Integration for detailed setup instructions.
Next Steps
- Commands Reference - All CLI commands
- Shell Aliases - More alias examples
- Editor Integration - Full editor setup