blob: f35601eb2ed274907cb124436c454178500ef61e (
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
- basedir="${basedir:-data}"
- years="${years:-$(find "$basedir" -mindepth 1 -maxdepth 1 -type d -regex '.*/[0-9]+' -printf '%f\n')}"
- journal() {
- set -e
- cd "$basedir"
- cat *.ledger 2> /dev/null || true
- for year in $years; do
- cat $year/*.ledger 2> /dev/null || true
- cat $year/income/*.ledger 2> /dev/null || true
- done
- cat ../bank/*.ledger 2> /dev/null || true
- cat ../receipts/*.ledger 2> /dev/null || true
- cat ../taxes/*.ledger 2> /dev/null || true
- }
- journal | hledger -f- "$@"
|