blob: f59e3e3db3eb71af49ff2d85db40e94826821270 (
plain)
- #!/bin/sh
- set -e
- infile="$1"
- dirname=$(dirname "$infile")
- basename=$(basename "$infile" .csv)
- outfile="${2:-$dirname/$basename.ledger}"
- rulesfile="$dirname/$basename.rules"
- {
- find * -wholename "$infile.rules" -execdir cat '{}' +;
- find * -wholename "$basename.*.rules" \! -name "$infile.rules" -execdir cat '{}' +;
- } > "$rulesfile"
- hledger print --rules-file "$rulesfile" -f "$infile" > "$outfile"
- rm "$rulesfile"
|