summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2018-07-03 00:45:38 +0200
committerJonas Smedegaard <dr@jones.dk>2018-07-03 00:45:38 +0200
commit24a0eb30b323d0fac2a4717330e507175d5feff5 (patch)
treec2ed349be084df5e1a1c21f9f543218a21880acb
parent42cfe15a0c8be7da2f20fa4fa5e89c320f5c80d9 (diff)
Restructure loading: Apply primo explicitly. Apply ultime. Apply defaults before loading each dir. Generate bank ledger with dot as floating-point separator.
-rwxr-xr-xbin/mycsv2ledger7
-rwxr-xr-xbin/myhledger8
2 files changed, 12 insertions, 3 deletions
diff --git a/bin/mycsv2ledger b/bin/mycsv2ledger
index f59e3e3..56b1ccd 100755
--- a/bin/mycsv2ledger
+++ b/bin/mycsv2ledger
@@ -8,9 +8,14 @@ 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"
+hledger print --rules-file "$rulesfile" -f "$infile" >> "$outfile"
rm "$rulesfile"
diff --git a/bin/myhledger b/bin/myhledger
index a7d81d6..cf73eef 100755
--- a/bin/myhledger
+++ b/bin/myhledger
@@ -20,12 +20,16 @@ years="${years:-$(find "$basedir" -mindepth 1 -maxdepth 1 -type d -regex '.*/[0-
journal() {
set -e
cd "$basedir"
- cat *.ledger 2> /dev/null || true
for year in $years; do
- cat $year/*.ledger 2> /dev/null || true
+ cat defaults.ledger 2> /dev/null || true
+ cat $year/primo.ledger 2> /dev/null || true
+ cat defaults.ledger 2> /dev/null || true
cat $year/assets/*.ledger 2> /dev/null || true
+ cat defaults.ledger 2> /dev/null || true
cat $year/income/*.ledger 2> /dev/null || true
+ cat defaults.ledger 2> /dev/null || true
cat $year/expenses/*.ledger 2> /dev/null || true
+ cat $year/ultimo.ledger 2> /dev/null || true
done
}