blob: 8bdf3a2f9b2655a640cf0be4f6b9f0cb43c2d669 (
plain)
- #!/bin/sh
- set -e
- infile="$1"
- dirname=$(dirname "$infile")
- basename=$(basename "$infile" .csv)
- outfile="${2:-$dirname/$basename.ledger}"
- rulesfile="$dirname/$basename.rules"
- cat << EOF > "$outfile"
- D 1,000.00 DKK
- EOF
- {
- 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"
|