blob: 56b1ccda95b246b42ee998ba1a41b69e44a10201 (
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 kr
- 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"
|