blob: 233faa5d4e5fd891484f12b24589a20aa0c71183 (
plain)
- #!/bin/sh
- # use hledger with piles of journal chunks
- #
- # Example usage:
- #
- # myhledger balance -p "every 6 months in 2012" --date2
- # myhledger balance -p "from 2012-07 to 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- "$@"
|