hledger add, balance assertions and multiple journals

Skip to first unread message

Alex Johnstone

Aug 20, 2021, 4:55:57 AM8/20/21
to hledger

I keep a separate journal for each account, and then have a single master that includes them all. 

When I go to use `hledger add -f creditcard.journal` it fails on balance assertions. However, running hledger check (on master journal) there's no issues. I guess as I've specified a specific file, hledger doesn't know about the transactions from the other journals that would balance this account (e.g. credit card payments). 

I can add --ignore-assertions to overcome this but was wondering if there was a better way to do this? (aside from changing how I manage my journal files). 


Simon Michael

Aug 20, 2021, 4:12:29 PM8/20/21
to hledger
I think -I/--ignore-assertions is the right solution in this situation.

If you did want to check assertions before (and while ?) running hledger add, I think you can do it by mentioning all files, with the one you want to add to listed first:

hledger add -f creditcard.journal checking.journal savings.journal ...

(not -f creditcard.journal -f master.journal, which would read creditcard.journal rwice).

Alex Johnstone

Aug 26, 2021, 8:04:40 AM8/26/21
to hledger
okay thanks. I'll probably stick with -I, as I run hledger check after doing all the accounts anyway.
Reply all
Reply to author
0 new messages