blob: 443947477bca6788e40084c8c5c66b7a706068d3 (
plain)
- #!/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- "$@"
|