summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mycsv2ledger12
-rwxr-xr-xbin/mymerkur2csv8
-rwxr-xr-xbin/mymerkur2ledger7
3 files changed, 20 insertions, 7 deletions
diff --git a/bin/mycsv2ledger b/bin/mycsv2ledger
new file mode 100755
index 0000000..b13e1b7
--- /dev/null
+++ b/bin/mycsv2ledger
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+infile="$1"
+basename=$(basename "$infile" .csv)
+outfile="${2:-$basename.ledger}"
+rulesfile="$basename.rules"
+
+cat "$basename".*.rules > "$rulesfile"
+hledger print --rules-file "$rulesfile" -f "$infile" > "$outfile"
+[ "-d" = "$2" ] || rm "$rulesfile"
diff --git a/bin/mymerkur2csv b/bin/mymerkur2csv
new file mode 100755
index 0000000..e4ffef4
--- /dev/null
+++ b/bin/mymerkur2csv
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+infile="$1"
+outfile="${2:-$(basename "$infile" .csv)_out.csv}"
+
+csvtool -t ";" -u COMMA square "$infile" > "$outfile"
diff --git a/bin/mymerkur2ledger b/bin/mymerkur2ledger
deleted file mode 100755
index e047935..0000000
--- a/bin/mymerkur2ledger
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-rulesfile="$1"
-shift
-
-csvtool -t ";" -u COMMA square "$@" \
- | hledger print ${rulesfile:+--rules-file "$rulesfile"} -f-