test.j
2025-01-01 Buy beans
expenses:food $2
assets -$2
~ every week from 2025-01-01 Buy soylent green
expenses:food:not people $1
assets -$1
cmdlist.txt
register --forecast -e 2025-02
register --forecast -e 2025-03
hledger -f test.j run cmdlist.txt will produce the same output for both commands. This is because it is using the cache, which has already generated forecast transactions, for the second call. The cache of InputOpts will need to remember the report span in the cases that forecast transactions are being generated.
$ hledger -f test.j run cmdlist.txt 2>&1 | grep cach
readAndCacheJournalFile reading and caching /home/username/test.j:
readAndCacheJournalFile reading and caching /home/username/test.j:
readAndCacheJournalFile using cache for /home/username/test.j:
I'll also note that it's attempting to read/run the cache three times, which is more than necessary given there are only two commands. Maybe this can be improved.