summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/myhledger31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/myhledger b/bin/myhledger
new file mode 100755
index 0000000..4439474
--- /dev/null
+++ b/bin/myhledger
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# use hledger with piles of journal chunks
+#
+# Example usage:
+#
+# myhledger balance -p "from 2012 to 2012-07-01" --effective
+# myhledger balance -p "from 2012-07-01 to 2013"
+
+set -e
+
+defaultbasedir="$HOME/Doc/Jones/ledger"
+
+if [ -n "$basedir" ]; then
+ :
+elif [ -d invoices ] && [ -d receipts ]; then
+ basedir=.
+elif [ -d ../invoices ] && [ -d ../receipts ]; then
+ basedir=..
+else
+ basedir="$defaultbasedir"
+fi
+
+journal() {
+ cat $basedir/bank/*.ledger 2> /dev/null || true
+ cat $basedir/invoices/*.ledger 2> /dev/null || true
+ cat $basedir/receipts/*.ledger 2> /dev/null || true
+ cat $basedir/taxes/*.ledger 2> /dev/null || true
+}
+
+journal | hledger -f- "$@"