From 52c1ee51aa96c9ba164bd2a25806cbd7fc248fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 25 Sep 2019 19:14:09 +0200 Subject: [PATCH] fix(hledger): add balance sheet on entry --- modules/hledger.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/hledger.nix b/modules/hledger.nix index 910aa0f..ab30b71 100644 --- a/modules/hledger.nix +++ b/modules/hledger.nix @@ -3,9 +3,12 @@ with lib; let cfg = config.niveum.hledger; hledger-git = pkgs.writers.writeDashBin "hledger-git" '' - GIT="${pkgs.git}/bin/git -C $(dirname $LEDGER_FILE)" + LEDGER_DIR="$(dirname $LEDGER_FILE)" + GIT="${pkgs.git}/bin/git -C ''${LEDGER_DIR}" if [ "$1" = entry ]; then - $GIT commit --all --message="$(date +%F)" + ${cfg.package}/bin/hledger balance -V > "$LEDGER_DIR/balance.txt" + $GIT add balance.txt + $GIT commit --all --message="$(date -Im)" else $GIT $* fi