blob: f0da9dc71be22f28582ead693b06a62939c48bae (
plain)
- #!/bin/sh
- # use hledger with piles of journal chunks
- #
- # Example usage:
- #
- # myhledger balance -p "every 6 months in 2012" --date2
- # myhledger balance -p 2012-07~2013"
- # myhledger reg :kp
- # myhledger reg desc:012001
- 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- "$@"
|