summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/bank/default.nix
blob: 9f3a44d79a8a4d2ada72d0f7375fcc5bc46ccfe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{ writeDashBin, coreutils, pass, hledger, diffutils }:

writeDashBin "bank" ''
  tmp=$(mktemp)
  ${pass}/bin/pass show hledger > $tmp
  ${hledger}/bin/hledger --file=$tmp "$@"
  ${pass}/bin/pass show hledger | if ${diffutils}/bin/diff $tmp -; then
    exit 0
  else
    ${coreutils}/bin/cat $tmp | ${pass}/bin/pass insert -m hledger
  fi
  ${coreutils}/bin/rm $tmp
''