aboutsummaryrefslogtreecommitdiff
path: root/bin/ledger
diff options
context:
space:
mode:
authorgxlin <[email protected]>2021-03-07 11:43:21 +0800
committergxlin <[email protected]>2021-03-07 15:18:19 +0800
commit278ede552736d0e87bf5799f60c7981b6a503a21 (patch)
treef3238562bfe74fbde2103925d90c3b318b1b4675 /bin/ledger
parentc6a810bf52cebd4b4b4af7febf64634af907b8bc (diff)
downloaddotfiles-278ede552736d0e87bf5799f60c7981b6a503a21.tar.gz
dotfiles-278ede552736d0e87bf5799f60c7981b6a503a21.tar.bz2
dotfiles-278ede552736d0e87bf5799f60c7981b6a503a21.zip
Add ledger report binary
Diffstat (limited to 'bin/ledger')
-rw-r--r--bin/ledger26
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/ledger b/bin/ledger
new file mode 100644
index 0000000..c3aa3b5
--- /dev/null
+++ b/bin/ledger
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+[ -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 ^Revenues --daily --collapse $extra_options
+ $prog --current --aux-date --no-pager bal ^Expenses ^Revenues --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