aboutsummaryrefslogtreecommitdiff
path: root/bin/ledger
blob: 5b33fd93d10d7c5e1759020b755a830fbd592c1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash

[ -f /usr/bin/ledger ] && prog=/usr/bin/ledger
[ -f /usr/local/bin/ledger ] && prog=/usr/local/bin/ledger

subcommand=$1
extra_options=${@:2}

case $subcommand in 
    bs) # Balance Sheet
        $prog --current --aux-date --no-pager bal ^Assets ^Liabilities $extra_options
        ;;
    cf) # Cash Flow
        $prog --no-pager reg ^Assets ^Liabilities --daily --collapse $extra_options
        ;;
    is) # Income Statement
        $prog --current --aux-date --no-pager reg ^Expenses ^Income --daily --collapse $extra_options
        $prog --current --aux-date --no-pager bal ^Expenses ^Income --collapse $extra_options
        ;;
    exp) # Expense Compare
        $prog --current --aux-date --no-pager bal ^Expenses --depth 1 --sort amount -X USD $extra_options
        $prog --current --aux-date --no-pager bal ^Expenses -% --depth 2 --sort amount -X USD $extra_options
        ;;
    *)
        $prog $@
        ;;
esac