@@ 3,7 3,8 @@
JOURNAL="$1"
CSV="$2"
RULES="$3"
-SKIP_LINES="${4:-0}" # Number of lines in the CSV before data (assuming there are no lines after data)
+CSV_LENGTH_OFFSET="${4:-0}" # Number of lines in the CSV before/after data
+
CSV_BASENAME="${CSV##*/}"
CSV_DIRNAME="$(dirname $CSV)"
@@ 19,7 20,7 @@ TMP_CSV_LATEST="$TMP_DIR/.latest.$CSV_BASENAME.csv"
journal_length () { hledger -f "$1" stat | awk '/^Transactions / { print $3 }'; }
# Check if running `hledger import` will create duplicate xacts.
-duplicates_p () { test ! $(("$JOURNAL_LENGTH" + "$LINES_ADDED_LENGTH" + "$SKIP_LINES")) -eq "$CSV_LENGTH"; }
+duplicates_p () { test ! $(("$JOURNAL_LENGTH" + "$LINES_ADDED_LENGTH" + "$CSV_LENGTH_OFFSET")) -eq "$CSV_LENGTH"; }
# Body
@@ 80,7 81,7 @@ was not equal to the sum of:
JOURNAL_LENGTH: $JOURNAL_LENGTH
LINES_ADDED_LENGTH: $LINES_ADDED_LENGTH
-SKIP_LINES: $SKIP_LINES"
+CSV_LENGTH_OFFSET: $CSV_LENGTH_OFFSET"
exit 1
fi