Skip to content

Instantly share code, notes, and snippets.



Last active Feb 14, 2020
What would you like to do?
Ledger Balance Sheet
LG="ledger -f main.ledger --force-color --depth=$DEPTH"
BALANCE_FORMAT="%(justify(scrub(display_total), 10, -1, true, color)) %(depth_spacer)%-(ansify_if(partial_account(options.flat), blue if color))\n%/%\$1\\n%/----------\\n"
$LG source </dev/null || exit 1
paste -d '|' \
<($LG --balance-format="$BALANCE_FORMAT" bal "$@" ^Assets) \
<($LG --balance-format="$BALANCE_FORMAT" --invert bal "$@" ^Liabilities ^Equity) \
| column -nt -s '|' \
| less -RF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment