blob: ea9366c7887b6385c234b231da52b1c30bf8cc67 (
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/assets/*.ledger 2> /dev/null || true
- cat $year/income/*.ledger 2> /dev/null || true
- cat $year/expenses/*.ledger 2> /dev/null || true
- done
- }
- journal | hledger -f- "$@"
|