summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/mycsv2ledger7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/mycsv2ledger b/bin/mycsv2ledger
index b13e1b7..d01ced6 100755
--- a/bin/mycsv2ledger
+++ b/bin/mycsv2ledger
@@ -7,6 +7,9 @@ basename=$(basename "$infile" .csv)
outfile="${2:-$basename.ledger}"
rulesfile="$basename.rules"
-cat "$basename".*.rules > "$rulesfile"
+{
+ find * -name "$infile.rules" -execdir cat '{}' +;
+ find * -name "$basename.*.rules" \! -name "$infile.rules" -execdir cat '{}' +;
+} > "$rulesfile"
hledger print --rules-file "$rulesfile" -f "$infile" > "$outfile"
-[ "-d" = "$2" ] || rm "$rulesfile"
+rm "$rulesfile"